Changing and Finding Keyboard Shortcuts in VS Code
Greetings, friends! Did you know there's an easy way to search for keyboard shortcuts in VS Code? On Macs, we can type Command + K, Command + S
in that order to quickly open up a list of keyboard shortcuts! On Windows, we can use the keyboard shortcut Ctrl + K, Ctrl + S
. Alternatively, we can open the Command Palette with Command + Shift + P
(on Macs) or Ctrl + Shift + P
(on Windows) and then search for "keyboard shortcuts" in the input field that appears.
The screenshot above is only a partial list of keyboard shortcuts (or keybindings). In VS Code, the keyboard shortcuts list gives us a lot of useful information. We can see the name of the command, the keybinding, the name of the trigger for when the keybinding can be used, and where the keybinding comes from (i.e. extension or VS Code). I actually have a VS Code extension called Colonize that quickly lets me add a semicolon to the end of a line with a quick keyboard shortcut. Super useful!
If we double-click on any of the rows, then a popup appears asking us what what new keybindings we would like to use for that particular command. It'll even inform us if any other commands share the same keybinding. Once the keybinding is changed, the Source
category will change to User
for that particular command.
If you would like to change the keybinding back to the default one, then right-click the keybinding and select the "Reset Keybinding" option in the menu that appears.
We can also use the search bar at the top of this list to search for particular commands. Try typing cursor
to see a list of commands related to cursors. You can search by the keybinding. Type command w
or cmd w
to find all commands that use command
and w
in their keybinding.
You can also search for only keybindings you have created. In the search bar, type @source:user
. You can right-click on any row and remove it if you prefer. We could have also filtered the keybindings by "user" using the three dots at the top-right of VS Code.
This special menu has different options available depending on the type of file or VS Code setting we're currently looking at. While on the "Keyboard Shortcuts" page, click on the three dots. Multiple options will appear including one to "Show User Keybindings."
If you would like to learn more about keybindings in VS Code, check out the official documentation. Keyboard shortcuts can greatly speed up development! ⚡