最新的vscode中修改默认的终端为Git Bash

在windows下,我们有些npm项目需要执行bash脚本,如果每次都是从文件夹通过“Git Bash Here”打开的话,我们的效率会变得极其低,所以我们要将vscode的终端配置为Git Bash,我们之前的老版本直接在settings.json配置以下内容即可

// "terminal.integrated.automationShell.windows": "",
// "terminal.integrated.shell.windows": "自己电脑的bash路径"

2021年6月12日更新

VSCode更新后,之前的配置会提示错误:

此项已弃用,配置默认 shell 的新推荐方法是在 `#terminal.integrated.profiles.windows#` 中创建一个终端配置文件,并将其配置文件名称设置为 `#terminal.integrated.defaultProfile.windows#` 中的默认值。此操作当前将优先于新的配置文件设置,但将来会发生更改。(2)终端在 Windows 上使用的 shell 的路径。详细了解如何配置 shell。

注意:以前的terminal.integrated.shell.windows已经废弃。

新方法

参考官方文档,修改配置文件,将下面的配置加到 setting.json文件。

"terminal.integrated.profiles.windows": {
        "PowerShell -NoProfile": {
          "source": "PowerShell",
          "args": [
            "-NoProfile"
          ]
        },
   "Git-Bash": {
          "path": "D:\\Git\\Git\\bin\\bash.exe(自己的bash路径)",
          "args": []
      }
 },
"terminal.integrated.defaultProfile.windows": "Git-Bash",
// "terminal.integrated.automationShell.windows": "", //废弃不要的
// "terminal.integrated.shell.windows": "D:\\Git\\Git\\bin\\bash.exe"//废弃不要的

配置完毕后,重启VSCODE,即完成效果如下

把它变回CMD终端

1.首先打开vscode里面的设置选项,搜索 shell 找到此选项

image

"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值