Is there a shortcut to move focus to the sidebar in Visual Studio Code?
Ctrl
0
is the default binding of View: Focus into Side Bar command that focuses sidebar regardless what it shows at the moment - be it Explorer, Source Control, Extensions or any other pane. (Or reveals its last visible state.)
Zero (0
) in this key combination represents character that "English-keyboard-layout" zero key in the top 'numerical' row produces in current regional keyboard layout. It is not the zero key in numpad.
Like most other actions it is easily discoverable either in the Command Palette (F1 or CtrlShiftP):
(N.B. é
instead of 0
due to aforementioned regional layout in effect), or in the Keyboard Shortcuts settings page (CtrlK CtrlS):
Btw Ctrl1 .. 3 focuses editor groups respectively.
If you'd like to have this (or other) key combination to act like two way "focus toggle" between editor and sidebar (like Show Explorer
behaves), you can alter your settings accordingly using distinct actions with identical key combination differentiated by excluding "when"
conditions. Resulting part of keybindings.json
would be
{ // Unbind unconditional default
"key": "ctrl+0",
"command": "-workbench.action.focusSideBar"
},
{ // to ←
"key": "ctrl+0",
"when": "!sideBarFocus",
"command": "workbench.action.focusSideBar"
},
{ // from →
"key": "ctrl+0",
"when": "sideBarFocus",
"command": "workbench.action.focusActiveEditorGroup"
},
These are the different shortcuts to focus on the various components(in order of the icons) of the sidebar.
File Explorer: ctrlshifte
Search: ctrlshiftf
Source Control: ctrlshiftg
Debug: ctrlshiftd
Extensions: ctrlshiftx
To toggle the visibility of the sidebar, just press ctrlb
Cmd
+ Shift
+ E
works for me. See screenshot