如何在Visual Studio Code中添加多个终端?

109
我们可以在Visual Studio Code中添加多个不同的终端吗?
我计划添加以下三个终端,并与所有这些一起使用:
  1. Windows命令提示符
  2. PowerShell
  3. Git Bash
我知道我需要在“首选项”→“设置”中添加以下命令:
 // // 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",

我想把以上三个命令添加到setting.json中。

Enter image description here

当我点击+时,应该打开不同的终端,并且我希望在不更改首选项的情况下与这些终端一起工作。 在Visual Studio Code中是否可能实现这个功能?

1
如果您在 PowerShell 终端中键入此命令,它将启动 Git Bash:& "c:\Program Files\git\bin\bash.exe" - Davos
2
自从https://code.visualstudio.com/updates/v1_35以来,您现在可以更轻松地完成此操作,请参见我完全在页面底部的答案。我通过谷歌进入此处,安装了扩展,然后一直阅读下去,注意到了Neil的评论,然后前往2019年5月的发布说明,并将其添加到此处作为信息提醒。 - edelwater
2022年最合适的答案是https://dev59.com/M1cQ5IYBdhLWcg3wCvY4#69748852。 - brunoff
12个回答

1

自动打开多个终端窗口的推荐方法是使用任务功能。请参阅Visual Studio Code文档中的自动启动终端


0

对于在 Windows 终端上的 WSL Ubuntu:

文件 -> 首选项 -> 设置 -> 点击右上角的代码图标

输入以下内容:

{
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\wsl.exe",
    "git.enableSmartCommit": true
}

是否可以使用VSCode进行远程SSH连接,其中目标IP和端口是动态的?我需要通过服务器A连接到远程服务器B。当我登录到服务器A时,我会根据服务器A上的sshd_configs被重定向到服务器B。当我通过命令行进行ssh时,它可以成功连接到服务器B。但是VSCode无法做到这一点。有任何想法吗? - Arun Chandramouli

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接