-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Seamless VS Code Integration
To run Cmder as the VS Code terminal, you may follow these steps:
-
Press Ctrl + , to access
VSCode Settings
-
Search for
settings.json
-
Click
Edit in settings.json
-
Append or modify the following into your configuration file:
Note: The below config produces a default Cmder terminal using
Cmd.exe
shell as if you launchedCmder.exe
. Theterminal.integrated.env.windows
are only valid withCmd.exe
based shells and will have no effect if using Powershell or Bash."terminal.integrated.shell.windows": "cmd.exe", "terminal.integrated.env.windows": { "debug_output": "0", "verbose_output": "0", "fast_init": "0", "nix_tools": "1", "time_init": "0", "max_depth": "1", "cmder_user_bin": "", "cmder_user_config": "", "user_aliases": "", "GIT_INSTALL_ROOT": "", "HOME": "", "SVN_SSH": "" }, "terminal.integrated.shellArgs.windows": [ "/k", "%USERPROFILE%\\cmder\\vendor\\bin\\vscode_init.cmd" ],
Substitute both [cmder_root]
with your Cmder installation directory.
Tip: You can define an environment variable to use as [cmder_root]
.
- Press Ctrl + ` (Control-Tilde) to open VS Code's terminal. You may now use Cmder with VS Code.
👉 Please note the use of cmd.exe
instead of cmder.exe
. More…
👉 Cmder and VS Code both have a hotkey mapping for Ctrl + `. You need to change Cmder's mapping if you want to use VS Code's mapping. More...
For more information/issues, read our guide. Here's a demo.
⚠ CAUTION: The command line interpreter in Windows has some issues with spaces in the path, such as C:\Program Files (x86)\Cmder
. We do not recommended to install Cmder in a path that contains spaces.
Instead, we recommend installing Cmder in a path that does not contain any spaces, such as: C:\apps\Cmder
or C:\tools\Cmder
to avoid any conflicts with VS Code.
If you for some reason really need to launch Cmder from a path with spaces, you might need to prepend a ^
symbol before each space, such that C:\\Example Directory with Spaces\\Cmder
will become C:\\Example^ Directory^ with^ Spaces\\Cmder
in your settings.json
file.
You may also have to escape the parentheses (
and )
as well as spaces. Here's an example:
C:\Program Files (x86)\Cmder → "C:\\Program^ Files^ ^(x86^)\\Cmder"
💾 Alternatively you could use 8.3 filename convention:
C:\Program Files\Cmder → "C:\\PROGRA~1\\Cmder"
(Use PROGRA~2
for Program Files (x86)
)
VS Code is able to work in portable mode. To install it as portable, just follow the official instructions and configure Cmder accordingly.
-
Extract the VSCode zip file to
%CMDER_ROOT%\bin\vscode
-
Create
%CMDER_ROOT%\bin\vscode\data
to enable portable mode. -
Create the below file in
%cmder_root%\bin\vscode.cmd
for launching VS Code Portable from Cmder:@call "%cmder_root%\bin\vscode\bin\code.cmd"
-
Start
Cmder
and typevscode
. -
Click
File->Preferences
, find and clickEdit in settings.json
. -
Add the below to
settings.json
"terminal.integrated.shell.windows": "cmd.exe", "terminal.integrated.shellArgs.windows": [ "/K", "%CMDER_ROOT%/vendor/bin/vscode_init.cmd", ]
Microsoft is trying to make PowerShell as the default shell for Windows 10. To integrate Cmder with VSCode using PowerShell, use the following settings. Everything else is the same as above.
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"terminal.integrated.shellArgs.windows": [
"-ExecutionPolicy", "Bypass",
"-NoLogo", "-NoProfile", "-NoExit",
"-Command", ". 'C:\\apps\\cmder\\vendor\\conemu-maximus5\\\\..\\\\profile.ps1'"
]
Of course, you should set the location of the profile.ps1
file according to your installation directory.
✅ Note the double backslashes which are required.
Also note that C:\apps\cmder\vendor\conemu-maximus5
would be the value of %ConEmuDir%
($env:ConEmuDir
in PowerShell), but that environment variable is not available to VSCode unless you define it.
Related to issue #1758, make sure your Cmder have the "%cexec%" feature.
In my case:
- I put vsCode into
%cmder_root%\bin\vsCode
folder,
(%cmder_root%
is the environment variable of your Cmder installation directory.)
- I use the following variables as my configuration file:
"terminal.integrated.shellArgs.windows": [
"/k",
"%cmder_root%\\vendor\\bin\\vscode_init.bat",
"/noautorun"
],
- I use the following commands in
user-profile.cmd
to run vsCode at startup:
%ccall% NOT "/noautorun" "start" "%cmder_root%\bin\vsCode\Code.exe %*"
- Press Ctrl + , to access
VSCode Settings
- Search for
settings.json
- Click
Edit in settings.json
- Update or add the following to your user settings:
"git.enabled": true,
"git.path": "[cmder_root]\\vendor\\git-for-windows\\cmd\\git.exe",
if it does not work, you can try another way
"terminal.integrated.shell.windows": "[cmder_root]\\vendor\\git-for-windows\\bin\\bash.exe",
Substitute [cmder_root]
with your Cmder installation directory.
Tip: You can define an environment variable to use as [cmder_root]
.
Here's a list of unofficial extensions that you can install:
- VSCodeCmder – Commands for VSCode to make it easier to use in a keyboard-only workflow
There is currently an issue regarding the VS Code Tasks with Cmder. More info: