Skip the 100-shortcut cheat sheets. These seven VS Code shortcuts, in the order to learn them, cover most of your day. Start with the Command Palette.
Adapted from the VS Code Essentials Companion Guide.
Search for VS Code shortcuts and you'll find lists of fifty, a hundred, sometimes two hundred of them. Nobody learns a list like that. You skim it, memorize two, forget them by Thursday, and go back to reaching for the mouse.
A shorter list works better, as long as it's in the right order. A small set of shortcuts covers most of a normal day: finding a file, finding a command, changing many lines at once, and moving around the editor. Learn those seven first and let everything else wait until you actually need it.
Shortcuts are shown as Windows/Linux / Mac.
Start here: the Command Palette
1. Ctrl+Shift+P / Cmd+Shift+P opens the Command Palette. This is the one to learn before any other, because it makes every other feature findable. Every command in VS Code, including the ones you've never heard of, is listed in this one search box. Press the shortcut, type a few words of what you want ("format", "word wrap", "select interpreter", "reload"), and pick it from the list.
It also teaches you the rest. Each command in the list shows its keyboard shortcut on the right, if it has one. Every time you use the palette to do something, you're shown the faster way to do it next time. You don't have to memorize shortcuts up front. You can look them up in the moment and let your hands pick them up over time.
If you only learn one shortcut this week, make it this one. It's also the answer to "how do I do X in VS Code?" for almost any X.
Moving around: files and symbols
2. Ctrl+P / Cmd+P is Quick Open. Type part of a filename and jump straight to it, with no clicking through folders in the Explorer. Fuzzy matching means usrmod will find user_model.py. This single habit does more to stop you from hunting through the sidebar than any other.
Quick Open has a few extra tricks once you're in it. Type : followed by a number to jump to that line in the current file. Type @ to jump to a function or class in the current file. Type > and it turns into the Command Palette, which is why the two feel like one tool.
3. Ctrl+` / Cmd+` toggles the integrated terminal. It opens the terminal at the bottom of the editor, already in your project folder, and the same shortcut hides it again. You'll use this far more often than you expect, and it keeps you out of a separate terminal window.
Editing: change more with less typing
4. Ctrl+D / Cmd+D selects the next occurrence. Put the cursor on a word and press it once to select the word. Press it again and VS Code selects the next match and gives you a second cursor there. Keep pressing to add more, then type once to edit all of them together. It's the quickest way to rename a variable inside a short block, and a good first taste of multi-cursor editing.
5. Alt+Up / Alt+Down (Option+Up / Option+Down on Mac) moves the current line. No cutting and pasting. The line moves up or down, and if you've selected several lines, they move together. Reordering code is a constant small chore, and this makes it one keypress.
6. F2 renames a symbol. Put the cursor on a variable, function, or class name and press F2. VS Code renames it everywhere it's used, across files if needed, and understands the code well enough not to touch other things that happen to share the text. For renaming real code, this is safer than Find and Replace, which will happily change matching words in comments and strings too.
Search: find things across the whole project
7. Ctrl+Shift+F / Cmd+Shift+F searches the whole project. Plain Ctrl+F only searches the file you're in. This searches every file, shows the matches grouped by file, and lets you click straight to any of them. When you can't remember where something lives, this is how you find it.
How to actually learn them
Don't try all seven on day one. Learn one at a time, in the order above, and give each a few days before adding the next.
Pick the one you're about to use and look at it right before you do the task. If you notice yourself clicking through the Explorer to find a file, stop and try Ctrl+P instead. If you notice yourself copy-pasting a line to move it, try Alt+Up. The shortcut sticks because you use it at the moment you'd have done it the slow way.
When you forget one, open the Command Palette and search for it. Since it shows you the shortcut next to the command, forgetting costs you a few seconds and no more.
Two mistakes worth knowing about ahead of time
Memorizing shortcuts you don't have a use for yet. A shortcut you never need doesn't stick, and learning twenty of them at once is how people end up with a list of shortcuts they can't recall. Add a new one only when you notice yourself doing something the slow way, over and over.
Assuming a shortcut is broken when it's just taken. Some shortcuts don't work because another program, or your operating system, has already claimed that key combination. If a shortcut does nothing, open the Command Palette, run Preferences: Open Keyboard Shortcuts, and search for the command. It shows what key it's bound to and lets you change it.
A habit that makes the rest easy
Before you reach for the mouse to do something in VS Code, ask yourself whether the Command Palette could do it. Nine times out of ten it can, and the tenth time you'll find out something new about the editor. Over a few weeks that one habit teaches you more than any cheat sheet, because you're always learning the shortcut for the thing you're actually doing.
If you'd like more posts like this sent straight to your inbox, subscribe to the newsletter.
Prefer to dig in yourself? The VS Code Essentials repo on GitHub has more free examples and exercises.
Top comments (0)