vscode设置git bash为默认终端

vscode设置git bash为默认终端

Previous

  1. 在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

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值