mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-10-31 09:22:15 +08:00 
			
		
		
		
	make vscode_init.cmd smart enough to apply cmder settings if launched from inside or outside cmder
This commit is contained in:
		
							
								
								
									
										27
									
								
								vendor/bin/vscode_init.cmd
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/bin/vscode_init.cmd
									
									
									
									
										vendored
									
									
								
							| @@ -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
									
								
							
							
						
						
									
										58
									
								
								vendor/bin/vscode_init_args.cmd.default
									
									
									
									
										vendored
									
									
										Normal 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! | ||||
							
								
								
									
										9
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/init.bat
									
									
									
									
										vendored
									
									
								
							| @@ -166,10 +166,10 @@ if "%CMDER_CLINK%" == "1" ( | ||||
|   %lib_console% verbose_output "WARNING: Incompatible 'ComSpec/Shell' Detetected Skipping Clink Injection!" | ||||
| ) | ||||
|  | ||||
| if "%CMDER_CONFIGURED%" == "2" ( | ||||
| if "%CMDER_CONFIGURED%" gtr 1 ( | ||||
|   %lib_console% verbose_output "Cmder is already configured, skipping Cmder Init!" | ||||
|  | ||||
|   goto CMDER_CONFIGURED | ||||
|   goto USER_ALIASES | ||||
| ) else if "%CMDER_CONFIGURED%" == "1" ( | ||||
|   %lib_console% verbose_output "Cmder is already configured, skipping to Cmder User Init!" | ||||
|  | ||||
| @@ -298,6 +298,7 @@ if defined CMDER_USER_CONFIG ( | ||||
|   %lib_profile% run_profile_d "%CMDER_USER_CONFIG%\profile.d" | ||||
| ) | ||||
|  | ||||
| :USER_ALIASES | ||||
| :: Allows user to override default aliases store using profile.d | ||||
| :: scripts run above by setting the 'aliases' env variable. | ||||
| :: | ||||
| @@ -342,7 +343,11 @@ if "%CMDER_ALIASES%" == "1" ( | ||||
| :: Add aliases to the environment | ||||
| call "%user_aliases%" | ||||
|  | ||||
| if "%CMDER_CONFIGURED%" gtr 1 goto CMDER_CONFIGURED | ||||
|  | ||||
| :: See vendor\git-for-windows\README.portable for why we do this | ||||
| :: A | ||||
| :: A | ||||
| :: Basically we need to execute this post-install.bat because we are | ||||
| :: manually extracting the archive rather than executing the 7z sfx | ||||
| if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user