make vscode_init.cmd smart enough to apply cmder settings if launched from inside or outside cmder

This commit is contained in:
Dax T. Games
2020-07-04 13:43:18 -04:00
parent 0f12de345b
commit f1c1354c00
3 changed files with 92 additions and 2 deletions

View File

@ -1,4 +1,31 @@
@echo off
:: Find root dir
if not defined CMDER_ROOT (
for /f "delims=" %%i in ("%~dp0\..\..") do (
set "cmder_root=%%~fi"
)
)
if defined cmder_user_bin (
if exist "%cmder_user_bin%\vscode_init_args.cmd" (
set CMDER_VSCODE_INIT_ARGS=%cmder_user_bin%\vscode_init_args.cmd
) else (
echo Creating initial "%CMDER_ROOT%\bin\vscode_init_args.cmd"...
copy "%CMDER_ROOT%\bin\vscode_init_args.cmd.default" "%cmder_user_bin%\vscode_init_args.cmd"
)
) else if exist "%CMDER_ROOT%\bin\vscode_init_args.cmd" (
set CMDER_VSCODE_INIT_ARGS=%CMDER_ROOT%\bin\vscode_init_args.cmd
) else (
echo Creating initial "%CMDER_ROOT%\bin\vscode_init_args.cmd"...
copy "%CMDER_ROOT%\bin\vscode_init_args.cmd.default" "%CMDER_ROOT%\bin\vscode_init_args.cmd"
)
if defined CMDER_VSCODE_INIT_ARGS (
call "%CMDER_VSCODE_INIT_ARGS%"
)
IF [%1] == [] (
REM -- manually opened console (Ctrl + Shift + `) --
CALL "%~dp0..\init.bat"

58
vendor/bin/vscode_init_args.cmd.default vendored Normal file
View File

@ -0,0 +1,58 @@
@echo off
:: Below are the default Cmder session settings:
::
:: See "%CMDER_ROOT%\README.md" for details on these settings.
::
:: `Cmder.exe` Arguments:
:: ----------------------
::
:: `/c [cmder_user_cfg_root]
:: set cmder_user_bin=[cmder_user_cfg_root]\bin
:: set cmder_user_config=[cmder_user_cfg_root]\config
::
:: `init.bat` Arguments
:: --------------------
::
:: `/d`
:: debug_output=0
::
:: `/v`
:: verbose_output=0
::
:: `/f`
:: fast_init=0
::
:: `/nix_tools`
:: nix_tools=1
::
:: `/t`
:: time_init=0
::
:: `/max_depth`
:: max_depth=1
::
:: `/user_aliases`
:: user_aliases=
::
:: `/git_install_root`
:: GIT_INSTALL_ROOT=
::
:: `/home`
:: HOME=
::
:: `/svn_ssh`
:: SVN_SSH=
echo Applying Cmder VSCode settings from '%~0'...
if defined CMDER_CONFIGURED (
:: Set Cmder settings here for when VSCode is launched inside Cmder.
set verbose_output=1
) else (
:: Set Cmder settings here for when VSCode is launched from outside Cmder.
set verbose_output=1
)
:: Set all required Cmder VSCode terminal environment settings above this line.
echo Applying Cmder VSCode settings is complete!