[筆記] vs code 設置終端


設置文件:
setting.json

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 的自定義安裝目錄。

powershell

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

2 使用插件實現多終端

插件:Shell launcher

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

在 Files->Preferences->Settings 中,編輯 settings.json 文件。
添加如下配置:

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"
        },
    ],

以上路徑替換為實際電腦上的路徑。

設置 vs code 的快捷鍵,刪除原來的 Ctrl + Shift + `` 對應的打開終端方式,將 shellLauncher.launch 映射到此快捷鍵上。

最終效果:
在按下快捷鍵 Ctrl + Shift + `` 時,會彈出菜單,讓你選擇需要打開的終端類型。


原文鏈接:
https://www.cnblogs.com/jasongrass/p/11608822.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM