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


当前回答

我把我的配置如下,因为我发现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。

其他回答

实际上,在VS Code 1.48.1中,有一个toggleTerminal命令;我不知道以前的版本中是否有;)您可以在键绑定中使用它。json文件。

这在Windows上适用,在Linux上也适用。

{
    "key": "ctrl+alt+right",
    "command": "workbench.action.terminal.toggleTerminal",
    "when": "editorTextFocus || terminalFocus"
}

我的1.56 VS Code的工作原理是:

Ctrl + ~     to focus on terminal window from editor
Ctrl + 9     to focus back on editor from terminal

这不是确切的问题,但我发现它非常有用和相关。

如果有人想从一个终端切换到另一个终端,也可以在Visual Studio的集成终端面板中打开,您可以搜索:

终端:关注下一个终端

或者添加以下快捷键,用键盘组合更快。

  {
    "key": "alt+cmd+right",
    "command": "workbench.action.terminal.focusNext",
    "when": "terminalFocus"
  },
  {
    "key": "alt+cmd+left",
    "command": "workbench.action.terminal.focusPrevious",
    "when": "terminalFocus"
  },

我通过设置>键盘快捷键来做到这一点,然后在它给出一个搜索栏类型的焦点终端的部分中选择该选项。它将要求输入您想要为此操作设置的组合。这样做。至于编辑器焦点,在搜索栏中输入“编辑器焦点”,并输入您想要的键。如果你出色地添加了一个键。可以通过编辑上面评论中提到的Jason来删除它

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