VS代码 - 集成终端 - 在代码和终端之间切换的键盘快捷键?

时间:2017-04-08 23:14:31

标签: powershell visual-studio-code vscode-settings

如何在VS Code中切换代码和集成终端之间的任何建议?

在PowerShell ISE中,例如: Ctr + D 终端和 Ctr + I 代码

找不到与VS Code类似的内容。

提前感谢您提出任何建议

2 个答案:

答案 0 :(得分:3)

目前,sqlaide在this thread上的最后一篇文章有​​一个很好的答案(可行)。打开你的keybindings.json *文件,并在方括号之间添加下面的文本。完成后,您可以使用Ctrl +`在代码和终端之间来回移动焦点。

*文件>偏好>键盘快捷键,然后单击keybindings.json。

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

答案 1 :(得分:0)

详细介绍上一个答案,我想分享我的工作配置,以便在有或没有全尺寸终端的情况下在代码和终端之间切换。

注意:我在Mac上进行了测试,并在EC2实例上运行VSCode。

settings.json

{
  "multiCommand.commands": [
    {
      "command": "multiCommand.move2Terminal",
      "sequence": [
        "workbench.action.toggleMaximizedPanel",
        "workbench.action.terminal.focus"
      ]
    },
    {
      "command": "multiCommand.move2Code",
      "sequence": [
        "workbench.action.toggleMaximizedPanel",
        "workbench.action.focusActiveEditorGroup"
      ]
    }
  ]
}

keybindings.json

[
  // Switch between Terminal and Code
  {
    "key": "shift+cmd+,",
    "command": "workbench.action.terminal.focus",
    "when": "!terminalFocus"
  },
  {
    "key": "shift+cmd+,",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "terminalFocus"
  }
  // Switch to Terminal full-screen and back to Code
  {
    "key": "shift+cmd+.",
    "command": "extension.multiCommand.execute",
    "args": {
      "command": "multiCommand.move2Terminal"
    },
    "when": "!terminalFocus"
  },
  {
    "key": "shift+cmd+.",
    "command": "extension.multiCommand.execute",
    "args": {
      "command": "multiCommand.move2Code"
    },
    "when": "terminalFocus"
  },
]