如何在 VS Code 中添加多个终端? [英] How to add multiple terminals in VS Code?
问题描述
我们可以在 VS Code 中添加多个不同的终端吗?我计划添加以下三个终端并使用所有这些终端:
<块引用>- Windows 命令提示符
- PowerShell
- Git Bash
我知道我需要在 Preferences => 中添加以下命令设置
////64 位 cmd 如果可用,否则为 32 位"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe",////64 位 PowerShell 如果可用,否则为 32 位"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",////git bash"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
我想在setting.json
中添加以上三个命令
当我点击 +
时,应该打开不同的终端,我想在不更改首选项的情况下使用这些终端.在 VS Code 中是否可能?
有一种方法可以通过安装扩展程序通过以下步骤实现:
找到一个名为
Shell launcher
的扩展并安装它,或者你可以找到它更多详情请查看官网:https://marketplace.visualstudio.com/items?itemName=Tyriar.shell-launcher
享受吧!
Can we add multiple different terminals in the VS Code? I am planning to add following three terminal and work with all of those :
- Windows Command prompt
- PowerShell
- Git Bash
I know I need to add the following command in
Preferences => Setting
// // 64-bit cmd if available, otherwise 32-bit "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe", // // 64-bit PowerShell if available, otherwise 32-bit "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe", // // Git Bash "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
I want to add all of the above three commands in
setting.json
And when I click
+
different terminal should open and I want to work with those terminals without changing the preferences. Is it possible in VS Code or not?解决方案There is a way to make this happens with these steps by installing an extension:
Find an extension called
Shell launcher
and install it or you can find it here. Reload VS Code if you want or after you finished all steps.Go to
Files --> Preferences --> Settings
and this will opensettings.json
file and you then insert this (you can edit this to your heart's content):
Code:
"shellLauncher.shells.windows": [ { "shell": "C:\\Windows\\<sysnative>\\cmd.exe", "label": "cmd" }, { "shell": "C:\\Windows\\<sysnative>\\WindowsPowerShell\\v1.0\\powershell.exe", "label": "PowerShell" }, { "shell": "C:\\Program Files\\Git\\bin\\bash.exe", "label": "Git bash" }, { "shell": "C:\\Windows\\<sysnative>\\bash.exe", "label": "WSL Bash" } ]
PS: You can use
shellLauncher.shells.linux
forLinux
orshellLauncher.shells.osx
formacOS
.- Go to
Files --> Preferences --> Keyboard Shortcuts
and then find on{}
icon on the top right corner to openkeybindings.json
file. Insert this:
Code:
[ { "key": "ctrl+alt+`", "command": "shellLauncher.launch" } ]
Update: Type
shelllauncher
into the search bar. You can then seeShell Launcher: Launch
command. Highlight and use any keybinding you like. For example, I picked Ctrl + Alt + (backtick)` for myself.You can reload your VS Code and click the key combination you have assigned and that will give you the option to choose which integrated terminal you want to use.
For more details, please check the official site: https://marketplace.visualstudio.com/items?itemName=Tyriar.shell-launcher
Enjoy!
这篇关于如何在 VS Code 中添加多个终端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!