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


当前回答

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

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

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

其他回答

我的解决方案:

只有一把钥匙 如果还没有终端:打开一个终端并聚焦在它上面 如果焦点在终端上:隐藏面板并切换回编辑器 如果焦点在编辑器上并且有一个终端:取消终端窗格并聚焦在它上

  {
    "key": "ctrl+shift+alt+cmd+t",
    "command": "workbench.action.terminal.new",
    "when": "!terminalIsOpen"
  },
  {
    "key": "ctrl+shift+alt+cmd+t",
    "command": "terminal.focus",
    "when": "terminalIsOpen && !terminalFocus"
  },
  {
    "key": "ctrl+shift+alt+cmd+t",
    "command": "workbench.action.closePanel",
    "when": "terminalIsOpen && terminalFocus"
  }

根据键盘布局的不同(QWERTY/QWERTZ/AZERTA等)

要找到你的快捷键,按Ctrl+Shift+P,然后转到首选项:键盘快捷键。

从那里搜索视图:切换终端

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

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

ctrl+ ':专注于集成终端

ctrl+1:聚焦编辑器(如果Editor -2命令是ctrl+2)

更多信息:https://medium.com/p/21969576c09c