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

我该怎么做呢?


当前回答

如果你想要选择控制台的类型,你可以把它写在“keybinding”文件中。(该文件可以在以下路径“文件->首选项->键盘快捷键”中找到) `

//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" 
}`

其他回答

按ctrl + Shift + p ->类型的settings.json 在文件的末尾将powershell改为Git Bash

通过运行terminal: Select default Profile命令配置您的默认集成终端,该命令也可以通过terminal下拉菜单访问。

看到https://code.visualstudio.com/docs/editor/integrated-terminal _terminal-profiles

整合的壳选项仍然有效,但已经贬值。解决方法是使用集成配置文件:

    "terminal.integrated.defaultProfile.windows": "C:\\Program Files\\Git\\bin\\bash.exe (migrated)",
    "terminal.integrated.profiles.windows": {
        "C:\\Program Files\\Git\\bin\\bash.exe (migrated)": {
            "path": "C:\\Program Files\\Git\\bin\\bash.exe",
            "args": []
        }
    }

你也可以在VSCode中按F1并键入/选择terminal: select default Profile(或terminal: select default Shell在旧的VSCode版本中)来选择你的默认终端。

年龄:

要在Visual Studio Code中更改项目的默认终端:

创建一个名为.vscode的文件夹 创建一个设置。Json文件: 写下你想要的设置

例如,如果你是一个窗口用户,想要设置“命令提示符”作为默认终端,你可以这样写:

"terminal.integrated.defaultProfile.windows": "Command Prompt"

你可以传递:“Git Bash”,“PowerShell”和“命令提示符”。

对于Linux,你将使用terminal.integrated.defaultProfile.linux,对于mac系统,你将使用:terminal.integrated.defaultProfile.osx