如何在 VS Code 中更改默认终端 [英] How to change default terminal in VS Code

查看:70
本文介绍了如何在 VS Code 中更改默认终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我在 VS Code 中打开终端时,它总是打开它的默认终端,我总是必须手动更改它.

Whenever I open terminal in VS Code it always opens it's default one, and I always have to manually change it.

这真的很烦人,因为我每天都在使用终端.我检查了工具栏中的 Terminal 设置,但找不到更改默认值的选项.我们该怎么做?

This is really annoying because I use terminal all the time every day. I checked Terminal settings in the toolbar but I can not find the option to change default. How can we do it?

推荐答案

github 上有很多关于这个的问题,参见例如 默认控制台从升级期间我想要的 Powershell 更改(我认为这是 v1.60 版本的最旧跟踪).

There are a lot of issues on github about this, see, e,g, Default console changed from what I wanted to Powershell during upgrade ( I think that is oldest tracking one for the v1.60 release).

我可以在 Stable v1.60 版本上复制该问题,但在具有完全相同设置的 Insiders 版本上不能.

I can replicate the problem on the Stable v1.60 build but not on the Insiders' Build with the exact same settings.

所以这不是你的设置,我相信 vscode 团队知道这一点.您的选择是

So it isn't your set-up and I'm sure the vscode team is aware of it. Your options are to

(1) 使用 Insiders' Build - 至少对我有用,
(2) 将 vscode 降级到 v1.59,
(3) 当我点击 Add Terminal + 按钮时,我会得到默认的 Git Bash 终端,或者
(4) 重命名您的默认配置文件 - 见下文.

(1) use the Insiders' Build - at least that works for me,
(2) downgrade vscode to v1.59,
(3) when I click the Add Terminal + button I do get my default Git Bash terminal, or
(4) rename your default profile - see below.

仅供参考,我的设置:

  "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": {  // "Git Bash" does not work
    "GitBash": {      // "GitBash" does work
      "path": "C:\\Program Files\\Git\\bin\\bash.exe",
      "icon": "terminal-bash"
    }
  },


  //  "terminal.integrated.defaultProfile.windows": "Git Bash"  // does not work for me
  "terminal.integrated.defaultProfile.windows": "GitBash"  // does work


  // deprecated but may still work for you
  // "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

以前尝试将 Git Bash 设置为默认配置文件,对于 Git Bash 建议使用 GitBash 代替(删除空格).直到 今天 在 v1.60 稳定版中,这对我来说从来没有用过.

Previously trying to set Git Bash as default profile, for Git Bash it was suggested to use GitBash instead (remove the space). That never worked for me until today in the v1.60 Stable Build.

因此,如果不起作用,可以尝试将您的个人资料名称更改为 Git BashWSL 以外的名称.

So might try changing your profile name to something other than Git Bash or WSL, etc, if that isn't working.

这篇关于如何在 VS Code 中更改默认终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆