有人知道在Visual Studio Code中切换编辑器和集成终端的快捷键(Mac和Linux)吗?


当前回答

尝试使用ctrl+ '来切换终端的可见性,从而切换焦点。

其他回答

我把我的配置如下,因为我发现ctrl+ '有点难按。

{
  "key": "ctrl+k",
  "command": "workbench.action.focusActiveEditorGroup",
  "when": "terminalFocus"
},
{
  "key": "ctrl+j",
  "command": "workbench.action.terminal.focus",
  "when": "!terminalFocus"
}

我还配置了以下内容,以便在编辑器组之间移动。

{
  "key": "ctrl+h",
  "command": "workbench.action.focusPreviousGroup",
  "when": "!terminalFocus"
},
{
  "key": "ctrl+l",
  "command": "workbench.action.focusNextGroup",
  "when": "!terminalFocus"
}

顺便说一下,我在Mac上从系统首选项=>键盘=>修改器键配置了Caps Lock。

有点晚了,但我在keybindings.json中配置了我的如下:

{
    "key": "ctrl+`",
    "command": "workbench.action.terminal.focus",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+`",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "terminalFocus"
},
{
    "key": "alt+`",
    "command": "workbench.action.terminal.toggleTerminal"
}

我想要单独的键来打开/关闭终端和在窗口之间来回切换焦点。

适用于任何键盘布局的简单WINDOWS解决方案(可能适用于其他操作系统,但未经测试)

我使用芬兰键盘,所以上面没有一个工作,但这应该适用于所有的键盘。

终端焦点:将鼠标悬停在集成终端的终端文本上。聚焦终端的快捷方式将会弹出-例如,我说CTRL+ö。 编辑器焦点:如上所述,使用CTRL+1。

通常,VS Code使用ctrl+j打开终端,所以我创建了一个键绑定来切换与ctrl+k组合,如下在keybindings.json:

[    
    {
        "key": "ctrl+k",
        "command": "workbench.action.terminal.focus"
    },
    {
        "key": "ctrl+k",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "terminalFocus"
    }
]

Shubham Jain的答案是现在使用内置的键盘快捷键的最佳选择。

我映射

Ctrl +;

和重新映射

Ctrl + L

这样你就可以在终端和编辑器之间移动焦点,并在近距离切换终端。