我在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" 
}`

其他回答

如果你想要选择控制台的类型,你可以把它写在“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" 
}`

因为你使用的是WSL, VSCode有专门的远程WSL扩展,所以你可以直接在VSCode中使用Linux环境。当您在Linux中打开项目时,默认情况下,它使用Linux默认shell(默认为bash),因此不需要配置。

如果你想切换到其他配置文件,有终端>集成>默认配置文件:Linux部分,所以你可以选择你最喜欢的一个。

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

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

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

年龄:

您可以通过按CTRL SHIFT P打开命令面板来更改终端

或者你可以点击顶部的“查看”,然后点击“打开命令面板”

然后输入Terminal:选择Default Profile

然后你输入你想要哪个终端。