bash VSCode 更改默认终端

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44435697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:33:12  来源:igfitidea点击:

VSCode Change Default Terminal

bashpowershellcmdterminalvisual-studio-code

提问by abhijeetps

I am using Visual Studio Code on my Windows 10 PC. I want to change my default terminal from Windows PowerShell to Bash on Ubuntu (on Windows).

我在 Windows 10 PC 上使用 Visual Studio Code。我想将我的默认终端从 Windows PowerShell 更改为 Ubuntu(在 Windows 上)上的 Bash。

How can I do that?

我怎样才能做到这一点?

回答by Levi Fuller

You can also select your default terminal by pressing F1in VS Code and typing/selecting Terminal: Select Default Shell.

您还可以通过按F1VS Code 并键入/选择Terminal: Select Default Shell选择默认终端

Terminal Selection

终端选择

Terminal Selection

终端选择

回答by AnandShanbhag

I just type following keywords in the opened terminal;

我只是在打开的终端中输入以下关键字;

  1. powershell
  2. bash
  3. cmd
  4. node
  5. python (or python3)
  1. 电源外壳
  2. 猛击
  3. 指令
  4. 节点
  5. 蟒蛇(或蟒蛇3)

See details in the below image. (VSCode version 1.19.1 - windows 10 OS) enter image description here

请参阅下图中的详细信息。(VSCode 版本 1.19.1 - Windows 10 操作系统) 在此处输入图片说明

It works on VS Code Mac as well. I tried it with VSCode (Version 1.20.1)

它也适用于 VS Code Mac。我用 VSCode(版本 1.20.1)试过了

回答by A. Larsson

Go to File > Preferences > Settings(or press Ctrl+,) then click the leftmost icon in the top right corner, "Open Settings (JSON)"

转到File > Preferences > Settings(或按Ctrl+ ,)然后单击右上角最左边的图标,“打开设置(JSON)”

screenshot showing location of icon

显示图标位置的屏幕截图

In the JSON settings window, add this (within the curly braces {}):

在 JSON 设置窗口中,添加以下内容(在花括号内{}):

"terminal.integrated.shell.windows": "C:\WINDOWS\System32\bash.exe"`

(Here you can put any other custom settings you want as well)

(您也可以在此处输入您想要的任何其他自定义设置)

Checkout that path to make sure your bash.exe file is there otherwise find out where it is and point to that path instead.

检查该路径以确保您的 bash.exe 文件在那里,否则找出它的位置并指向该路径。

Now if you open a new terminal window in VS Code, it should open with bash instead of PowerShell.

现在,如果您在 VS Code 中打开一个新的终端窗口,它应该使用 bash 而不是 PowerShell 打开。

回答by Jhon Stiven Guevara Velasco

If you want to select the type of console, you can write this in the file "keybinding.json" (this file can be found in the following path "File-> Preferences-> Keyboard Shortcuts") `

如果要选择控制台的类型,可以在“keybinding.json”文件中写这个(这个文件可以在下面的路径“File-> Preferences-> Keyboard Shortcuts”中找到)`

//with this you can select what type of console you want
{
    "key": "ctrl+shift+t",
    "command": "shellLauncher.launch"
},

//and this will help you quickly change console
{ 
    "key": "ctrl+shift+j", 
    "command": "workbench.action.terminal.focusNext" 
},
{
    "key": "ctrl+shift+k", 
    "command": "workbench.action.terminal.focusPrevious" 
}`