vscode设置git bash为默认终端
Previous
- 在settings.json文件中设置"terminal.integrated.shell.windows": “E:\Git\bin\bash.exe”
Latest
新版本的vscode会提示:
This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in `#terminal.integrated.profiles.windows#` and setting its profile name as the default in `#terminal.integrated.defaultProfile.windows#`. This will currently take priority over the new profiles settings but that will change in the future.
该设置已被弃用,当前还能用,但未来是否生效就不一定了
参考vscode官方文档中的terminal配置文档,新设置需要修改两个参数
1. terminal.integrated.profiles.windows
{
"terminal.integrated.profiles.windows": {
"PowerShell -NoProfile": {
"source": "PowerShell",
"args": ["-NoProfile"]
}
}
这里支持source、path两种方式,我采用的是path方式
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git-Bash": {
"path": "E:\\Git\\bin\\bash.exe",
"args": []
}
}
设置完这里,git bash就成了vscode的terminal之一
2. terminal.integrated.defaultProfile.windows
该参数用于设置vscode默认的terminal,这里再设置为git bash就好了。
"terminal.integrated.defaultProfile.windows": "Git-Bash"
3.重启vscode,查看默认的terminal
|