[笔记] vs code 设置终端

设置文件:
setting.jsonhtml

1 设置自定义终端

cmd

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

cmder

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "terminal.integrated.env.windows": {"CMDER_ROOT": "D:\\GreenTools\\cmder"},
    "terminal.integrated.shellArgs.windows": ["/k", "D:\\GreenTools\\cmder\\vendor\\init.bat"],

其中,D:\GreenTools\cmder 为 cmder 的自定义安装目录。git

powershell

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",

2 使用插件实现多终端

插件:Shell launchergithub

Tyriar/vscode-shell-launcher: VS Code extension that enables easy launching of multiple shell configurations in the terminalshell

在 Files->Preferences->Settings 中,编辑 settings.json 文件。
添加以下配置:json

Windows 的配置:windows

"shellLauncher.shells.windows": [
        {
            "shell": "C:\\WINDOWS\\System32\\cmd.exe",
            "label": "cmd"
        },
        {
            "shell": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
            "label": "PowerShell"
        },
        {
            "shell": "D:\\Program Files\\Git\\bin\\bash.exe",
            "label": "Git bash"
        },
    ],

以上路径替换为实际电脑上的路径。bash

设置 vs code 的快捷键,删除原来的 Ctrl + Shift + `` 对应的打开终端方式,将 shellLauncher.launch 映射到此快捷键上。插件

最终效果:
在按下快捷键 Ctrl + Shift + `` 时,会弹出菜单,让你选择须要打开的终端类型。code


原文连接:
http://www.javashuo.com/article/p-ovzquysi-hs.htmlhtm

相关文章
相关标签/搜索