Is there a hotkey to switch between split window panes?

Visual Studio-CodeHotkeys

Visual Studio-Code Problem Overview


Visual Studio Code has a hotkey combination to split the current window to 2 or 3 panes:

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

Unfortunately, I can't find a way to switch between such panes without the mouse. My old habit to use F6 does not work either.

Is it supported in Visual Studio Code editor or not?

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

https://code.visualstudio.com/docs/customization/keybindings#_editorwindow-management

For Windows: Ctrl+1, Ctrl+2 and Ctrl+3.

For Mac: Cmd+1, Cmd+2 and Cmd+3.

There is no circular switch between panes, similar to what Ctrl+tabs does for files, though.

Solution 2 - Visual Studio-Code

If you're used to working in vim (and/or tmux) and want to move around with ctrl+hjkl

add these to 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"    }]

Solution 3 - Visual Studio-Code

Use F6 to Cycle Between Editor Groups

There is a circular switch between panes. It's called "Cycle Between Editor Groups."

Out of the box, it is unassigned. We can assign it to F6.

  1. Open Visual Studio Code.
  2. Go to File > Preferences > Keyboard Shortcuts.
  3. Add the following entry to keybindings.json.
  4. You do not have to restart code. It already works.

keybindings.json

// Place your key bindings in this file to overwrite the defaults
[    {        "key": "f6",         "command": "workbench.action.navigateEditorGroups"     }]

Alternatively

Alternatively, use the out of the box window management hotkeys.

  • Ctrl +1 Focus into Left Editor Group

  • Ctrl +2 Focus into Side Editor Group

  • Ctrl +3 Focus into Right Editor Group

  • Ctrl +K Ctrl+Left Focus into Editor Group on the Left

  • Ctrl +K Ctrl+Right Focus into Editor Group on the Right

Solution 4 - Visual Studio-Code

For Mac users and the latest VS Code 1.17:

  1. Switching between panes - Cmd+[1,2,3...], where 1,2,3 is the pane number
  2. Cycling between all open files:
  • forward - Cmd+Shift+]
  • backwards - Cmd+Shift+[

Solution 5 - Visual Studio-Code

Another way is to use Ctrl + PageUp/PageDow to switch between panes.

Solution 6 - Visual Studio-Code

Alt+ā† and Alt+ā†’ works out of the box on Windows. It will only switch between split screen panes and it will not reactivate inactive files inside the panes.

Solution 7 - Visual Studio-Code

If you mean editor group, here it is.

enter image description here

Solution 8 - Visual Studio-Code

What you are looking for is option workbench.action.terminal.focusNextPane:

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

Solution 9 - Visual Studio-Code

Obviously the best answer is the hidden comment on the top answer. Not sure why there isn't an answer for it:

CMD + SHIFT + [

and

CMD + SHIFT + ]

I am not sure why anyone would use cmd + 1 or its variants.

Solution 10 - Visual Studio-Code

Yes, there is a hotkey to switch between split "editor" window panes, if that is what you mean.

It has to be configured though. This is because the command that allows cycling thru editor panes (aka editor groups) has no default keyboard mapping/binding. Open the "Keyboard Shortcuts" menu option and search for workbench.action.navigateEditorGroups . Click the + icon to add/assign a keybinding. I mapped it to Alt+Q because on a qwerty keyboard 'q' is right next to the Tab key. Given that Alt+Tab cycles thru open OS Windows, it seems sort of natural there.

Solution 11 - Visual Studio-Code

cmd + option + Left/Right Arrows worked for me.

Solution 12 - Visual Studio-Code

Try Option+Tab for switching sequentially, Cmd+ for switching by number and shift+cmd+[ (or ]) switches between tabs across editors

Solution 13 - Visual Studio-Code

If none of the above worked for you and you want just a simple ctrl-h to bind to the left pane and ctrl-l to bind to the right pane then do this:

  1. Open up keyboard shortcuts ( Ctrl-k, Ctrl-s )

  2. Do a search for firstEditorGroup and change key binding of workbench.action.focusFirstEditorGroup to ctr-h

  3. Do another search for secondEditorGroup and change key binding of workbench.action.focusSecondEditorGroup to ctr-h

This is a simple setup if you only ever have two editor panes up.

Solution 14 - Visual Studio-Code

The command View: Navigate Between Editor Groups worked for me, on the MacOS version (1.54.3).

Keyboard shorcut

Solution 15 - Visual Studio-Code

By default, Ctrl+Tab cycles through editors in the current group, but not between groups. We can simply extend the default shortcut to get the behavior we want. The VS Code user guide tells us what we need to add to our keybindings.json:

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

This will modify Ctrl+Tab to cycle through all open editors, not just the ones in the current group.

While it won't directly switch between groups, I prefer this solution since it combines both types of navigation (moving between groups, moving between editors) into a single shortcut that is already in my muscle memory.

Solution 16 - Visual Studio-Code

I recently found this key binding which switch focus between split panes in group.

"workbench.action.focusOtherSideEditor"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbialixView Question on Stackoverflow
Solution 1 - Visual Studio-CodebialixView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeDan AndreassonView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeShaun LuttinView Answer on Stackoverflow
Solution 4 - Visual Studio-CodedemisxView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeValdas StonkusView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeTamás PanyiView Answer on Stackoverflow
Solution 7 - Visual Studio-CodedexttoView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeDmitry KarpovView Answer on Stackoverflow
Solution 9 - Visual Studio-CodeCharlie ParkerView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeMark DalsasoView Answer on Stackoverflow
Solution 11 - Visual Studio-Codelando2319View Answer on Stackoverflow
Solution 12 - Visual Studio-CodeVivuView Answer on Stackoverflow
Solution 13 - Visual Studio-CodeIsaac PakView Answer on Stackoverflow
Solution 14 - Visual Studio-CodemacquackView Answer on Stackoverflow
Solution 15 - Visual Studio-CodeMalcolmView Answer on Stackoverflow
Solution 16 - Visual Studio-CodeNithin PMView Answer on Stackoverflow