Windows上的Visual代码默认使用PowerShell作为集成终端。如果要使用Visual代码中的Bash,应遵循哪些步骤?
发布于 2018-06-03 12:26:23
对我来说,这是唯一有效的组合!
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
"terminal.integrated.shellArgs.windows": [
"--command=usr/bin/bash.exe",
"-l",
"-i"
]
使用git-bash.exe作为...shell.windows
,每次bash在VS!
谢天谢地终于成功了!!否则,我计划彻底清除VS并重新安装它(让我重新安装我的所有扩展并重新进行自定义!)
发布于 2021-08-24 15:34:56
Visual可以检测并列出配置Git Bash
菜单中安装的Terminal: Select Default Profile
,就像许多其他答案已经描述的那样,但我从未遇到过这种情况。对于那些不像我这样幸运的人,您可以手动将自定义配置文件添加到Visual代码的settings.json
中:
{
// Tested in Visual Studio Code version 1.58.2, 1.59.1
// Notice: my git install path is `D:\Git\bin\bash.exe`
//"terminal.integrated.shell.windows": "D:\\Git\\bin\\bash.exe",
// This works fine for me for a long time,
// but in latest versions this is reported as deprecated,
// you can keep this and sometimes Visual Studio Code will prompt to help
// `migrate` it into new setting.
// This part can be generated by Visual Studio Code
"terminal.integrated.profiles.windows": {
// This seems to be a reserved profile name, and also does not work for
// me
"Git Bash": {
"path": "D:\\Git\\bin\\bash.exe",
"icon": "terminal-bash"
},
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
// Add your custom one with a different profile name from "Git Bash"
"gitbash": {
"path": "D:\\Git\\bin\\bash.exe",
"icon": "terminal-bash"
}
},
// Set the custom profile as default
"terminal.integrated.defaultProfile.windows": "gitbash",
// ...
}
发布于 2018-02-07 03:06:20
我遵循了Paul DeCarlo的DeCarlo,使用了(WSL)中的Bash,而不是Git附带的Bash。它们与答案中的上述步骤相同,但在用户设置中使用下面的步骤。
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe",
这对我来说是第一次。这对这些东西来说是很少见的。
https://stackoverflow.com/questions/42606837
复制相似问题