[笔记] 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