vscode配置bash终端作为默认终端

首先参考博客,旧的vscode可以配置成功,但是下载的新版的vscode没有这个shell.windows配置项,采用以下方法解决
参考vscode官方文档,文档中有一段是

Profiles can be created using either a path or a source, as well as a
set of optional arguments. A source is available only on Windows and
can be used to let VS Code detect the install of either PowerShell or
Git Bash. Alternatively a path pointing directly to the shell
executable can be used.
大概意思就是配置source后者path,source仅在Windows有效且自动检测是否安装其他终端,path则是直接指定终端位置即可用

所以直接修改profiles.windows配置,新版的配置中不能使用shell.windows,但提供了automationShell.windows,说是可以override shell.windows的配置,同时要配置上git.path,不然会报错。使用defaultProfile.windows设置默认终端,配置如下:

{
    "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": "D:\\Git\\Git\\bin\\bash.exe"
        }
    },
    "terminal.integrated.automationShell.windows": "‪D:\\Git\\Git\\bin\\bash.exe",
    "git.path": "‪D:\\Git\\Git\\bin\\git.exe",
    "terminal.integrated.defaultProfile.windows": "Git-Bash",
}
  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值