Change default terminal app in Visual Studio Code

2020-01-30 03:26发布

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.

6条回答
Summer. ? 凉城
2楼-- · 2020-01-30 03:26

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)

查看更多
欢心
3楼-- · 2020-01-30 03:27

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

enter image description here

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

enter image description here

  1. Open in Terminal

enter image description here

  1. iTerm is now default terminal launched from VSCode

enter image description here

查看更多
一纸荒年 Trace。
4楼-- · 2020-01-30 03:31

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"

enter image description here

查看更多
在下西门庆
5楼-- · 2020-01-30 03:41
贼婆χ
6楼-- · 2020-01-30 03:50

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

Terminal: Select Default Shell

its so much easier

查看更多
forever°为你锁心
7楼-- · 2020-01-30 03:51

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

查看更多
登录 后发表回答