如何在VSCode2021年4月正确集成Cmder?

我想将 Cmder 集成到我的 Vscode 设置中,但在 2021 年 4 月的 vscode 更新中,不推荐使用命令“terminal.integrated.shell.windows”和“terminal.integrated.shellArgs.windows”。

我在 Windows 上使用 VS Code 64bit,我尝试修改我的settings.json文件,以创建一个 Cmder 配置文件作为集成终端,如下所示:

  "terminal.integrated.profiles.windows": {
    "Cmder": {
      "source": "Cmder",
      "overrideName": true,
      "icon": "cmder",
      "env": {"CMDER_ROOT": "C:toolscmder"},
      "path": "%CMDER_ROOT%Cmder.exe",
      "args": ["/K", "%CMDER_ROOT%vendorbinvscode_init.cmd"],
    },
  },
  "terminal.integrated.defaultProfile.windows": "Cmder",

但是,集成的“Cmder”配置文件不起作用,并且命令terminal.integrated.defaultProfile.windows": "Cmder",出现“此设置只能应用于应用程序用户设置”。

还有其他人试图将 Cmder 集成为 vscode 终端的集成配置文件吗?

回答

  1. 打开用户设置(文件 -> 首选项 -> 设置)。
  2. 键入terminal.integrated.Profiles.windows并单击Edit in settings.json
  3. 在终端中定义新配置文件并设置Cmder为默认配置文件:
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}Sysnativecmd.exe",
                "${env:windir}System32cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash",
        },
        "Windows PowerShell": {
            "path": "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe"
        },
        "Cmder": {
            "path": [
                "${env:windir}Sysnativecmd.exe",
                "${env:windir}System32cmd.exe"
            ],
            "env": {"CMDER_ROOT": "C:toolscmder"},
            "args": [
                "/K",
                "%CMDER_ROOT%vendorbinvscode_init.cmd"
            ],
            "icon": "cmder",
        }
    },
    "terminal.integrated.defaultProfile.windows": "Cmder",
  1. 打开一个新终端(终端 -> 新终端)

确保您的 Cmder 目录存在于 C:tools

享受。

  • Replace `"terminal.integrated.profile.windows": "Cmder"` to
    `"terminal.integrated.defaultProfile.windows": "Cmder"`

以上是如何在VSCode2021年4月正确集成Cmder?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>