How to change the integrated terminal in Visual Studio code

Visual Studio-CodePreference

Visual Studio-Code Problem Overview


I want to change integrated terminal to CMDER i use VS Code on Windows 8.1.

I checked the docs and also preference file, but I am confused which line to change.


External Terminal
// Customizes which terminal to run on Windows.
"terminal.external.windowsExec": "%COMSPEC%",

// Customizes which terminal application to run on OS X.
"terminal.external.osxExec": "Terminal.app",

// Customizes which terminal to run on Linux.
"terminal.external.linuxExec": "xterm",
Integrated Terminal
// The path of the shell that the terminal uses on Linux.
"terminal.integrated.shell.linux": "sh",

// The command line arguments to use when on the Linux terminal.
"terminal.integrated.shellArgs.linux": [],

// The path of the shell that the terminal uses on OS X.
"terminal.integrated.shell.osx": "sh",

// The command line arguments to use when on the OS X terminal.
"terminal.integrated.shellArgs.osx": [],

// The path of the shell that the terminal uses on Windows. When using shells shipped with Windows (cmd, PowerShell or Bash on Ubuntu), prefer C:\Windows\sysnative over C:\Windows\System32 to use the 64-bit versions.
"terminal.integrated.shell.windows": "C:\\Windows\\system32\\cmd.exe",

// The command line arguments to use when on the Windows terminal.
"terminal.integrated.shellArgs.windows": [],

// Controls the font family of the terminal, this defaults to editor.fontFamily's value.
"terminal.integrated.fontFamily": "",

// Controls whether font ligatures are enabled in the terminal.
"terminal.integrated.fontLigatures": false,

// Controls the font size in pixels of the terminal, this defaults to editor.fontSize's value.
"terminal.integrated.fontSize": 0,

// Controls the line height of the terminal, this number is multipled by the terminal font size to get the actual line-height in pixels.
"terminal.integrated.lineHeight": 1.2,

// Controls whether the terminal cursor blinks.
"terminal.integrated.cursorBlinking": false,

// Controls whether locale variables are set at startup of the terminal, this defaults to true on OS X, false on other platforms.
"terminal.integrated.setLocaleVariables": false,

// A set of command IDs whose keybindings will not be sent to the shell and instead always be handled by Code. This allows the use of keybindings that would normally be consumed by the shell to act the same as when the terminal is not focused, for example ctrl+p to launch Quick Open.
"terminal.integrated.commandsToSkipShell": [
    "editor.action.toggleTabFocusMode",
    "workbench.action.debug.continue",
    "workbench.action.debug.restart",
    "workbench.action.debug.run",
    "workbench.action.debug.start",
    "workbench.action.debug.stop",
    "workbench.action.quickOpen",
    "workbench.action.showCommands",
    "workbench.action.terminal.clear",
    "workbench.action.terminal.copySelection",
    "workbench.action.terminal.focus",
    "workbench.action.terminal.focusNext",
    "workbench.action.terminal.focusPrevious",
    "workbench.action.terminal.kill",
    "workbench.action.terminal.new",
    "workbench.action.terminal.paste",
    "workbench.action.terminal.runSelectedText",
    "workbench.action.terminal.scrollDown",
    "workbench.action.terminal.scrollDownPage",
    "workbench.action.terminal.scrollToBottom",
    "workbench.action.terminal.scrollToTop",
    "workbench.action.terminal.scrollUp",
    "workbench.action.terminal.scrollUpPage",
    "workbench.action.terminal.toggleTerminal"
],

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

To change the integrated terminal on Windows, you just need to change the terminal.integrated.shell.windows line:

  1. Open VS User Settings (Preferences > User Settings). This will open two side-by-side documents.
  2. Add a new "terminal.integrated.shell.windows": "C:\\Bin\\Cmder\\Cmder.exe" setting to the User Settings document on the right if it's not already there. This is so you aren't editing the Default Setting directly, but instead adding to it.
  3. Save the User Settings file.

You can then access it with keys Ctrl+backtick by default.

Solution 2 - Visual Studio-Code

It is possible to get this working in VS Code and have the Cmder terminal be integrated (not pop up).

To do so:

  1. Create an environment variable "CMDER_ROOT" pointing to your Cmder directory.
  2. In (Preferences > User Settings) in VS Code add the following settings:

"terminal.integrated.shell.windows": "cmd.exe"

"terminal.integrated.shellArgs.windows": ["/k", "%CMDER_ROOT%\\vendor\\init.bat"]

Solution 3 - Visual Studio-Code

I know is late but you can quickly accomplish that by just typing Ctrl+Shift+P and then type "default" - it will show an option that says:

> Terminal: Select Default Shell

It will then display all the terminals available to you.

Solution 4 - Visual Studio-Code

From [Official Docs][1] > Correctly configuring your shell on Windows is a matter of locating > the right executable and updating the setting. Below is a list of > common shell executables and their default locations. > > There is also the convenience command Select Default Shell that can be > accessed through the command palette which can detect and set this for > you.

So you can open a command palette using ctrl+shift+p, use the command Select Default Shell, then it displays all the available command line interfaces, select whatever you want, VS code sets that as default integrated terminal for you automatically.

If you want to set it manually find the location of executable of your cli and open user settings of vscode(ctrl+,) then set

"terminal.integrated.shell.windows":"path/to/executable.exe"

Example for gitbash on windows7:

"terminal.integrated.shell.windows":"C:\\Users\\stldev03\\AppData\\Local\\Programs\\Git\\bin\\bash.exe",

[1]: https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration)%22

Solution 5 - Visual Studio-Code

For OP's terminal Cmder there is an integration guide, also hinted in the VS Code docs.

If you want to use VS Code tasks and encounter problems after switch to Cmder, there is an update to @khernand's answer. Copy this into your settings.json file:

"terminal.integrated.shell.windows": "cmd.exe",

"terminal.integrated.env.windows": {
  "CMDER_ROOT": "[cmder_root]" // replace [cmder_root] with your cmder path
},
"terminal.integrated.shellArgs.windows": [
  "/k",
  "%CMDER_ROOT%\\vendor\\bin\\vscode_init.cmd" // <-- this is the relevant change
  // OLD: "%CMDER_ROOT%\\vendor\\init.bat"
],

The invoked file will open Cmder as integrated terminal and switch to cmd for tasks - have a look at the source here. So you can omit configuring a separate terminal in tasks.json to make tasks work.

Starting with VS Code 1.38, there is also "terminal.integrated.automationShell.windows" setting, which lets you set your terminal for tasks globally and avoids issues with Cmder.

"terminal.integrated.automationShell.windows": "cmd.exe"

Solution 6 - Visual Studio-Code

I was successful via settings > Terminal > Integrated > Shell: Linux

from there I edited the path of the shell to be /bin/zsh from the default /bin/bash

  • there are also options for OSX and Windows as well

screencap of vs settings view

@charlieParker - here's what i'm seeing for available commands in the command pallette

enter image description here

Solution 7 - Visual Studio-Code

If you want to change the external terminal to the new windows terminal, here's how.

Solution 8 - Visual Studio-Code

Probably it is too late but the below thing worked for me:

  1. Open Settings --> this will open settings.json
  2. type terminal.integrated.windows.shell
  3. Click on {} at the top right corner -- this will open an editor where this setting can be over ridden.
  4. Set the value as terminal.integrated.windows.shell: C:\\Users\\<user_name>\\Softwares\\Git\\bin\\bash.exe
  5. Click Ctrl + S

Try to open new terminal. It should open in bash editor in integrated mode.

Solution 9 - Visual Studio-Code

The method explained in the accepted answer has been deprecated, now the new recommended way to configure your default shell is by creating a terminal profile in #terminal.integrated.profiles.windows# and setting its profile name as the default in #terminal.integrated.defaultProfile.windows#.

The old method will currently take priority over the new profiles settings but that will change in the future.

See an example for powershell taken from the docs

{
  "terminal.integrated.profiles.windows": {
    "My PowerShell": {
      "path": "pwsh.exe",
      "args": ["-noexit", "-file", "${env:APPDATA}PowerShellmy-init-script.ps1"]
    }
  },
  "terminal.integrated.defaultProfile.windows": "My PowerShell"
}

Solution 10 - Visual Studio-Code

Working as of 02-Dec-2021.

> In settings.json

 {
	"go.toolsManagement.autoUpdate":true,
	"terminal.integrated.profiles.windows":{
		"My Bash":{
			"path":"D:\\1. Installed_Software\\Git\\bin\\bash.exe"
		}
	},
	"terminal.integrated.defaultProfile.windows":"My Bash"
}

Reference: https://code.visualstudio.com/docs/editor/integrated-terminal#_terminal-profiles

Solution 11 - Visual Studio-Code

change external terminal

enter image description here

windows terminal , which has been mentioned by others, is an alternative of alacrity, which is a terminal (emulator)

As stated in vscode, Cmder is a shell, just like powershell or bash.

enter image description here

"terminal.integrated.profiles.windows": {
    "cmder": {
        //  "path": "F:\\cmder\\Cmder.exe",  // 这样会开external terminal
      "path": "C:\\WINDOWS\\System32\\cmd.exe",
      "args": ["/K", "F:\\cmder\\vendor\\bin\\vscode_init.cmd"]
    }
  },
"terminal.integrated.profiles.linux": { "zsh": { "path": "zsh" }, },
"terminal.integrated.defaultProfile.windows": "PowerShell",

enter image description here

The statment in cmder' repo is misleading

enter image description here

Different shells under a terminal:

enter image description here If you want to change the external terminal to the new windows terminal, here's how.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser7111196View Question on Stackoverflow
Solution 1 - Visual Studio-CodembernardeauView Answer on Stackoverflow
Solution 2 - Visual Studio-CodekhernandView Answer on Stackoverflow
Solution 3 - Visual Studio-Codeetp23View Answer on Stackoverflow
Solution 4 - Visual Studio-CodeMohana Naga Venkat SayempuView Answer on Stackoverflow
Solution 5 - Visual Studio-Codeford04View Answer on Stackoverflow
Solution 6 - Visual Studio-CodemcgrawView Answer on Stackoverflow
Solution 7 - Visual Studio-Codeuser12459317View Answer on Stackoverflow
Solution 8 - Visual Studio-Codeerror404View Answer on Stackoverflow
Solution 9 - Visual Studio-CodeCasualCoder3View Answer on Stackoverflow
Solution 10 - Visual Studio-CodeinfiniteLearnerView Answer on Stackoverflow
Solution 11 - Visual Studio-CodeGood PenView Answer on Stackoverflow