-->

Change default terminal app in Visual Studio Code

2020-01-30 03:02发布

问题:

I want to change the default terminal app used by Visual Studio Code for Mac. I am thinking it is part of preferences or settings json, but unsure.

回答1:

No. But you can vote for this feature here: https://visualstudio.uservoice.com/forums/293070-visual-studio-code



回答2:

Here's an example of how to make another terminal the default for VSCode, in this example I've downloaded iTerm2 and copied iTerm2 to Applications.

  1. Code (Menu) > Preferences > User Settings

  1. Edit settings.json "terminal.external.osxExec": "iTerm.app" and "terminal.explorerKind": "external"

  1. Open in Terminal

  1. iTerm is now default terminal launched from VSCode



回答3:

For those that want to change the default integrated terminal NOT just the external, and add custom themes, show which git branch you are on, and whether or not files need to be staged or committed for example.

Follow these short steps:

Make sure you have these installed:

iTerm2, oh-my-zsh

Install a powerline font (I am using Menlo which is a nice looking and very popular font).

Go here and click on download

Open the file

Click on install font

(Note: without this, vscode integrated terminal will not render themes correctly)

Open the .zshrc file by running this command:

cd ~ ; code .zshrc

Change iTerm's theme to agnoster:

Press ⌘f to open search in the .zshrc file

Type ZSH_THEME

Search until you find the live code, NOT the commented out code :)

Edit the code it so it looks like ZSH_THEME="agnoster"

Save the file

Open vscode settings using shortcut:

⌘,

Inside of vscode settings, you will see two panels. On the right panel paste this:

"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Menlo for Powerline"

Assuming the settings were empty before, it should now look like this:

{
    "terminal.external.osxExec": "iTerm.app",
    "terminal.integrated.shell.osx": "/bin/zsh",
    "terminal.integrated.fontFamily": "Menlo for Powerline"
}

Finished! Enjoy your new iced out terminal

-(Optional customization)-

If you want your prompt to display something other than your username such as a thunder bolt, like in mine or anything you want

Open agnoster theme by runnning this command:

cd ~/.oh-my-zsh/themes/ ; code agnoster.zsh-theme

Open search by pressing:

⌘f

Paste this in search bar:

prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"

To change your what your prompt displays, edit ONLY this part:

$USER@%m

DO NOT CHANGE this part:

prompt_segment black default "%(!.%{%F{yellow}%}.)

In conclusion, the code should now look something like this:

prompt_segment black default "%(!.%{%F{yellow}%}.) Insert here whatever your heart desires"

(Note: Technically you can change everything about your terminal prompt, but for the sake of keeping this short, and simple we only edited the username part)



回答4:

I recently changed my terminal in VSCode to ozh, its just 1 step and 1 line.

  1. Open Command Palette using View > Command Palette ( or simply Command + Shift + P )

  2. add the following line to the user settings.

    "terminal.integrated.shell.osx": "zsh"



回答5:

From visual studio code blog:

// 64-bit cmd it available, otherwise 32-bit
"terminal.integrated.shell.windows":"C:\\Windows\\sysnative\\cmd.exe"
// 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows":"C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"

Reference: Integrated Terminal



回答6:

well I know it's so late, but you could just change it by running command

Terminal: Select Default Shell

its so much easier