Last modified 2022-07-10.
Time to read: 3 minutes.
Useful Default Key Bindings
- Ctrl+K Ctrl+S
Display / edit the Keyboard Shortcuts definitions.
You can filter the keybindings by pressing Alt+K or clicking the icon of the little keyboard at the top right of the Keyboard Shortcut page, then press the keys that you want to see the key binding for. The keyboard icon starts keystroke recording mode. Recording mode is sticky; each time you revisit the Keyboard Shortcuts tab you can just press the keys you are interested in to see their bindings. Step by step:
When you press the Ctrl key you will see
"ctrl"displayed, and recording mode continues to listen to what you type. Don't do this right now, but FYI, if you toggle keystroke recording mode now, and then remove the quotes around
"ctrl", you will see a sorted list of all the key chords bound to Ctrl.
Next, when you add the Shift key to the key chord, you then see
"ctrl+shift"displayed. Don't do this right now, but FYI, if you toggle keystroke recording mode now, and then remove the quotes, you will see a sorted list of all the key chords bound to Ctrl+Shift.
- Finally, adding the = key to the key chord shows all the commands bound to Ctrl+Shift+=.
- When you press the Ctrl key you will see
- Ctrl+K+0 (zero)
- Completely fold the active editor contents.
- Ctrl+K+1 (one)
- Fold level 1 the active editor contents.
- Fold level 2 the active editor contents.
- Toggle side bar visibility.
- Show names of recently opened tabs, which might contain files to edit, or might be VSCode settings, or VSCode key bindings, etc. Click on a tab name to open it. This key binding is bound to Go to File, which is slightly logical but a not a good descriptive name.
- Open the Command Palette.
- Ctrl+L G
- Open the active (currently edited) file on GitHub in the default web browser. Requires the Open in GitHub extension.
- Ctrl+, (comma)
- Open the Settings tab.
- Reopen the most recently closed editor tab.
- Format the current file.
Annoying Side Bar Auto Reveal
When editing a file, if you Ctrl+click on a function, method or class name defined in a dependency, the dependency's folder will be expanded in the side bar. Some dependencies are deeply nested, which means that the side bar expands quite a lot. In order to close the folders in the side bar it is necessary to go all the way back to the top of that folder, which is annoying and wastes time.
In settings, look for Explorer: Auto Reveal, which controls whether the explorer should automatically reveal and select files when opening them.
To do that, bring up settings with Ctrl+, (comma),
and then type
reveal ex into the filter.
The default value is
Change the value to
Bonus: Reveal Active File in Side Bar
To scroll to a file that you are editing in the list of files in the side bar, right-click on the file's tab, then select Reveal in side bar.
Even better, define a keyboard shortcut to do this:
- Bring up the Keyboard Shortcuts definitions by typing Ctrl+K Ctrl+S.
reveal sideinto the search bar.
- Double-click on File: Reveal Active File in Side Bar.
- For my desired key shortcut, I pressed Ctrl+Shift+Alt+R, then pressed Enter.
User settings are stored in
%AppData%\Code\User\ on Windows, in files called
Project settings are stored in
.vscode/ on all platforms, in files called
Workspace settings are stored in files with a
They can be painful to work with because paths in them are OS-dependent.
Extensions are stored in