我在Windows 10电脑上使用Visual Studio Code。我想把我的默认终端从Windows PowerShell更改为Ubuntu上的Bash(在Windows上)。
我该怎么做呢?
我在Windows 10电脑上使用Visual Studio Code。我想把我的默认终端从Windows PowerShell更改为Ubuntu上的Bash(在Windows上)。
我该怎么做呢?
当前回答
通过运行terminal: Select default Profile命令配置您的默认集成终端,该命令也可以通过terminal下拉菜单访问。
看到https://code.visualstudio.com/docs/editor/integrated-terminal _terminal-profiles
其他回答
如果你想要选择控制台的类型,你可以把它写在“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"
}`
通过运行terminal: Select default Profile命令配置您的默认集成终端,该命令也可以通过terminal下拉菜单访问。
看到https://code.visualstudio.com/docs/editor/integrated-terminal _terminal-profiles
只需按Ctrl + Shift +p 搜索“终端:选择默认配置文件”单击 您将看到终端选项并选择Git Bash
我只是在打开的终端中键入以下关键字;
powershell bash cmd 节点 Python(或python3)
详见下图。(VSCode版本1.19.1 - windows 10操作系统)
它也适用于VS Code Mac。我尝试用VSCode(版本1.20.1)
离开@arielhad的解决方案…
我的VSCode版本是1.57.1。
打开settings.xml文件:
Ctrl + Shift + p 输入“Open Settings (JSON)”并选择。
增加如下内容:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"path": [
"${env:windir}\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
"${env:windir}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
],
"source": "PowerShell",
"icon": "terminal-powershell",
"args": [
"-NoLogo",
"-ExecutionPolicy",
"Bypass"
]
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"icon": "terminal-cmd"
},
//START: THIS DOES NOT WORK
"Git Bash": {
"path": [
"C:\\Program Files\\Git\\bin\\bash.exe",
],
"source": "Git Bash",
"icon": "terminal-bash"
}
// END: THIS DOES NOT WORK
//START: THIS WORKS
"GitBash": {
"path": [
"C:\\Program Files\\Git\\bin\\bash.exe",
],
"icon": "terminal-bash"
}
// END: THIS WORKS
}
我不知道为什么第二种方法有效,但它确实有效。“Git Bash”似乎是一个保留名称,我猜你不能设置路径。