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?
Shift+Alt+0
toggles between vertical and horizontal editor layouts (workbench.action.toggleEditorGroupLayout
)
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.
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"
}
]
Ctrl
+x
line completion (probably amongst other things) so it felt sensible to disable these shortcuts in insert mode: "when": "vim.mode != 'Insert'"
keybindings.json
- see helpful doc here: code.visualstudio.com/docs/getstarted/…
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.
Open Visual Studio Code. Go to File > Preferences > Keyboard Shortcuts. Add the following entry to keybindings.json. 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
For Mac users and the latest VS Code 1.17:
Switching between panes - Cmd+[1,2,3...], where 1,2,3 is the pane number Cycling between all open files:
forward - Cmd+Shift+]
backwards - Cmd+Shift+[
Another way is to use Ctrl + PageUp/PageDow to switch between panes.
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.
If you mean editor group, here it is.
https://i.stack.imgur.com/zxAQB.png
cmd+Left/Right
goes to the next panel regardless if it's another tab in the same or a different editor group
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"
},
focusPreviousPane
option.
"when": "terminalFocus"
specification, it makes managing the terminals quicker because I don't have to add a shortcut like Ctrl + `
.
alt+down
and removing terminalFocus
as explanied by @PhilippeFanaro makes it perfect ;)
alt
key the focus is lost and the menu bar gets focused instead (the bar with file, edit, selection, view, go etc, etc... options on the very top)
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.
cmd + 1
or it's other variants (2
, 3
, 4
, etc) because that's how most tabbed applications work. CMD + SHIFT + ]
treats all the panes like they are sibling tabs on the same window.
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.
cmd
+ option
+ Left/Right Arrows
worked for me.
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.
Try Option+Tab for switching sequentially, Cmd+ for switching by number and shift+cmd+[ (or ]) switches between tabs across editors
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:
Open up keyboard shortcuts ( Ctrl-k, Ctrl-s ) Do a search for firstEditorGroup and change key binding of workbench.action.focusFirstEditorGroup to ctr-h 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.
The command View: Navigate Between Editor Groups
worked for me, on the MacOS version (1.54.3).
https://i.stack.imgur.com/4WRcG.png
I recently found this key binding which switch focus between split panes in group.
"workbench.action.focusOtherSideEditor"
On Mac:
Move Editor Left ⌘K← workbench.action.moveEditorLeftInGroup
Move Editor Right ⌘K→ workbench.action.moveEditorRightInGroup
Success story sharing
Ctrl + Shift + [ / ]
seems to be mapped to code folding and unfolding in my version (1.46). I never changed the defaults.Does this mean they changed the defaults?workbench.action.navigateEditorGroups
(can be found in Keyboard shortcuts by searching or in associated json)