Visual Studio Code有一个热键组合来将当前窗口分割为2或3个窗格:

"key": "ctrl + \",               "command": "workbench.action.splitEditor"

不幸的是,我无法在没有鼠标的情况下在这些窗格之间切换。我以前用F6的习惯也不管用了。

Visual Studio代码编辑器是否支持它?


当前回答

在Mac:

Move Editor Left    ⌘K←     workbench.action.moveEditorLeftInGroup
Move Editor Right   ⌘K→     workbench.action.moveEditorRightInGroup

其他回答

默认情况下,Ctrl+Tab在当前组中的编辑器之间循环,但不在组之间循环。我们可以简单地扩展默认快捷方式来获得我们想要的行为。VS Code用户指南告诉我们需要在keybindings.json中添加什么:

[
  {
    "key": "ctrl+tab",
    "command": "workbench.action.quickOpenPreviousRecentlyUsedEditor",
    "when": "!inEditorsPicker"
  },
  {
    "key": "ctrl+shift+tab",
    "command": "workbench.action.quickOpenLeastRecentlyUsedEditor",
    "when": "!inEditorsPicker"
  }
]

这将修改Ctrl+Tab遍历所有打开的编辑器,而不仅仅是当前组中的编辑器。

虽然它不能直接在组之间切换,但我更喜欢这个解决方案,因为它将两种类型的导航(在组之间移动,在编辑器之间移动)结合到一个简单的快捷方式中,并且已经在我的肌肉记忆中了。

如果您习惯在vim(和/或tmux)中工作,并希望使用ctrl+hjkl四处移动

将这些添加到keybindings.json中

[
    {
        "key": "ctrl+h",
        "command": "workbench.action.navigateLeft"
    },
    {
        "key": "ctrl+l",
        "command": "workbench.action.navigateRight"
    },
    {
        "key": "ctrl+k",
        "command": "workbench.action.navigateUp"
    },
    {
        "key": "ctrl+j",
        "command": "workbench.action.navigateDown"
    }
]

对于Mac用户和最新的VS Code 1.17:

在窗格之间切换- Cmd+[1,2,3…],其中1,2,3为窗格号 在所有打开的文件之间循环:

前进- Cmd+Shift+] 倒数- Cmd+Shift+[

Alt+←和Alt+→在Windows上可以开箱即用。它只会在分屏窗格之间切换,不会重新激活窗格内的非活动文件。

你要找的是workbench.action.terminal.focusNextPane:

{ 
  "key": "alt+down",
  "command": "workbench.action.terminal.focusNextPane",
  "when": "terminalFocus"
},
{ 
  "key": "alt+right",
  "command": "workbench.action.terminal.focusNextPane",
  "when": "terminalFocus"
},