[筆記] 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

相關文章
相關標籤/搜索