VScode 1.60.0 设置默认终端为Git Bash < windows系统>

3,201 阅读1分钟

1. 问题背景

难受,一觉醒来发现 VScode 进行了自动更新,版本号为1.60.0,默认终端已经变成了powershell呜呜呜,要怎么恢复成熟悉的Git Bash呢?

图片.png

2. 配置步骤

  • ctrl + shift + p 打开命令面板,输入 open settings json 打开json设置

图片.png

  • 找到你的 bash.exe 的安装路径,我的是"D:\Git\usr\bin\bash.exe",忘记安装在哪里了可以用which bash查询

  • 原先这类的配置命令已经失效,请将原先的语句删除或者+//变成注释:

"terminal.integrated.shell.windows":路径
"terminal.integrated.automationShell.windows":路径
  • 配置默认终端的新推荐方法是在 #terminal.integrated.profiles.windows# 中创建一个终端配置文件,并将其配置文件名称设置为#terminal.integrated.defaultProfile.windows# 中的默认值。

  • 接着,直接在settings.json文件的大括号中加入以下命令,注意路径改成你自己的路径,别的不要动:

"terminal.integrated.defaultProfile.windows""Git-Bash",
"terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source""PowerShell",
      "args": []
    },
    "Git-Bash": {
      "path""D:\\Git\\usr\\bin\\bash.exe",
      "args": []
    }
  },
  "terminal.integrated.tabs.enabled"false,

我的全部配置是这样的:

{ "workbench.colorTheme": "Default Dark+", 
"security.workspace.trust.untrustedFiles": "open", 
"editor.suggestSelection": "first", 
"vsintellicode.modify.editor.suggestSelection":"automaticallyOverrodeDefaultValue", 
"editor.fontSize": 15, 
"terminal.integrated.defaultProfile.windows": "Git-Bash", "terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "args": [] }, "Git-Bash": { "path": "D:\\Git\\usr\\bin\\bash.exe", "args": [] } }, 
"terminal.external.windowsExec": "D:\\Git\\usr\\bin\\bash.exe", 
"workbench.sideBar.location": "right", "files.autoSave": 
"afterDelay", "git.path": "D:\\Git\\usr\\bin\\bash.exe", 
"vetur.ignoreProjectWarning": true"terminal.integrated.tabs.enabled": false"[vue]": { "editor.defaultFormatter": "octref.vetur" }, 
"explorer.confirmDelete": false, 
"[javascript]": { "editor.defaultFormatter": "vscode.typescript-language-features" }, 
"terminal.integrated.automationShell.windows": "", }

3. 结果

  • 设置完成之后,保存settings.json文件,重启VScode,看到新终端,搞定! 图片.png

更详细地了解如何配置终端,请查看官方文档:code.visualstudio.com/docs/editor…

参考文章:zhuanlan.zhihu.com/p/365625019