如何从Visual Studio Code中删除自定义终端配置文件?

3
我该如何删除图片中显示的自定义配置文件“New 1”?

enter image description here

2个回答

13

我正在使用Zsh,因此建议进行配置。

"terminal.integrated.profiles.osx": {
    "zsh": {
        "path": "/bin/zsh",
        "icon": "star",
        "env": {
        "TESTING_VAR": "abc"
        }
    }
},
"terminal.integrated.defaultProfile.osx": "zsh",

2

如VS Code文档中的配置文件部分所述,当您创建自定义终端配置文件时,它会将一个条目添加到您的settings.json文件中:

The recommended way to create a new profile is to run the Terminal: Select Default Profile command and activate the configure button on the right side of the shell to base it on. This will add a new entry to your settings that can be tweaked manually in your settings.json file.

...

"terminal.integrated.profiles.windows": {
 "PowerShell -NoProfile": {
   "source": "PowerShell",
   "args": ["-NoProfile"]
 }
},
"terminal.integrated.profiles.linux": {
 "zsh (login)": {
   "path": "zsh",
   "args": ["-l"]
 }
}

打开你的用户设置,你会发现terminal.integrated.profiles.<OS>设置下新增了对应操作系统下你自定义配置文件的条目。最好直接打开settings.json文件,或者从UI“编辑settings.json”中打开它:

设置UI

设置 UI 截图

settings.json

"terminal.integrated.profiles.osx": {
    "1": {
        "path": "bash"
    }
}

(我正在使用Mac OS,所以我的文件在.osx中。它相应地添加到.linux.windows)

要删除您的自定义配置文件:

  1. terminal.integrated.profiles中简单地删除您的自定义配置文件("1": {...}
  2. 重新加载/重启VS Code

当VS Code重新加载/重启时,已删除的自定义配置文件应该不见了。(似乎这些自定义配置文件只在VS Code启动期间被读取和加载一次)。

请注意,这仅适用于自定义配置文件。对于内置配置文件,您必须将配置文件设置为null

To remove profile entries from the dropdown, set the name of the profile to null. For example, to remove the Git Bash profile on Windows, use this setting:

"terminal.integrated.profiles.windows": {
 "Git Bash": null
}

我无法在设置 UI 或 settings.json 中看到我创建的自定义配置文件,但它仍然存在于菜单中。 - Jarrod Smith

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接