VS Code Shortcuts to Master as a Senior Developer

The VS Code keyboard shortcuts that save me the most time.

There are times when you watch someone fly through a codebase in VS Code and wonder how they got there so fast. It's rarely typing speed. It's that they almost never reach for the mouse. You don't need to learn every shortcut, just the dozen or so that cover what you do all day.

Each shortcut below is written as macOS / Windows and Linux, and they're all VS Code defaults.

Quick Open

Cmd+P / Ctrl+P

Type part of a file name and hit enter. This is the fastest way to get to any file in your project, and it's the one I use most. Add : and a number to jump to a line, for example Button.jsx:42.

Command Palette

Cmd+Shift+P / Ctrl+Shift+P

Every command in VS Code lives here, including ones from extensions. If you forget a shortcut, search for the command and the palette shows its key binding next to it. That's a good way to learn new ones.

Go to Symbol

Cmd+Shift+O / Ctrl+Shift+O

Lists the functions, classes and variables in the current file. Type : after the @ to group them by kind. To search symbols across the whole workspace use Cmd+T / Ctrl+T.

Go to Definition and Peek

F12 jumps to where a function or variable is defined. Opt+F12 / Alt+F12 peeks at the definition in an inline window instead, so you don't lose your place. Press Esc to close it.

Find All References

Shift+F12 shows every place a symbol is used in a peek window. Shift+Opt+F12 / Shift+Alt+F12 opens the same results in the References panel in the sidebar, which is easier to work through when there are a lot of them.

Rename Symbol

F2

Renames a variable, function or component everywhere it's used, including across files and imports. It's much safer than find and replace because it understands your code rather than just matching text.

Multi-cursor editing

  • Cmd+D / Ctrl+D selects the next match of the current word. Keep pressing it to add more cursors.
  • Opt+Click / Alt+Click adds a cursor wherever you click.
  • Cmd+Shift+L / Ctrl+Shift+L selects every match in the file at once.
  • Cmd+Opt+Up/Down / Ctrl+Alt+Up/Down adds a cursor on the line above or below (Shift+Alt+Up/Down on Linux).

For example, put a cursor at the start of each line, type ", press End (Cmd+Right on a Mac), then type ",:

// before
name
email
role
// after
"name",
"email",
"role",

Move and copy lines

Opt+Up/Down / Alt+Up/Down moves the current line, or the selected lines, up or down. Shift+Opt+Up/Down / Shift+Alt+Up/Down duplicates them above or below (Ctrl+Shift+Alt+Up/Down on Linux). No more cut, arrow, arrow, paste.

While you're at it, Cmd+Shift+K / Ctrl+Shift+K deletes a line and Cmd+/ / Ctrl+/ toggles a comment.

Toggle the terminal

Ctrl+` on every platform

Opens and closes the integrated terminal. I keep it hidden most of the time and pop it open to run a command.

Toggle the sidebar

Cmd+B / Ctrl+B

Hides the file explorer to give your code more room. Combine it with the terminal toggle and you can get back to a clean editor with two key presses.

Zen Mode

Cmd+K Z / Ctrl+K Z

This is a chord: press Cmd+K, let go, then press Z. It hides everything but the editor and goes full screen. Press Esc twice to leave.

Quick Fix

Cmd+. / Ctrl+.

When you see the lightbulb or a squiggly underline, this opens the fixes for it: add a missing import, fix a lint error, convert a function to an arrow function and so on. Auto imports alone make this worth learning.

Go Back

Ctrl+- / Alt+Left (Ctrl+Alt+- on Linux)

After jumping to a definition you'll want to get back to where you were. This takes you to your previous cursor location, even across files. Go Forward is Ctrl+Shift+- / Alt+Right.

Customize your shortcuts in keybindings.json

You can change any of these. Open the Keyboard Shortcuts editor with Cmd+K Cmd+S / Ctrl+K Ctrl+S, or run "Preferences: Open Keyboard Shortcuts (JSON)" from the Command Palette to edit the file directly.

// keybindings.json
[
{
"key": "cmd+shift+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus"
},
{
// a leading "-" removes the default binding
"key": "cmd+shift+d",
"command": "-workbench.view.debug"
}
]

The key is the shortcut, command is the command ID (right click a command in the Keyboard Shortcuts editor to copy it), and when controls where the shortcut is active. Use ctrl instead of cmd on Windows and Linux.

Pick two or three of these, use them for a week until they stick, then add a few more. The mouse will start to feel slow.

Have some feedback on this post? .