VS Code Keyboard Shortcuts

Visual Studio Code shortcuts that every developer should know. 19 shortcuts for Visual Studio Code on Windows and Linux (use Cmd on Mac).

Updated .

General

ShortcutAction
Ctrl + Shift + PCommand Palette
Ctrl + PQuick Open a file
Ctrl + ,Settings
Ctrl + `Toggle the terminal
Ctrl + BToggle the sidebar
Ctrl + K, Ctrl + SKeyboard shortcuts editor

Editing

ShortcutAction
Ctrl + /Toggle line comment
Alt + Up / DownMove the line up or down
Shift + Alt + Up / DownCopy the line up or down
Ctrl + Shift + KDelete the line
Ctrl + DSelect the next occurrence
Ctrl + Shift + LSelect all occurrences
Alt + ClickAdd a cursor
Shift + Alt + FFormat the document
ShortcutAction
F12Go to definition
F2Rename symbol
Ctrl + GGo to line
Ctrl + Shift + FSearch across files
Ctrl + TabSwitch between open editors

How to learn keyboard shortcuts for good

  1. Pick three shortcuts you would use today. Ignore the rest for now.
  2. Use them on purpose for a week, even when the mouse feels quicker. Each use strengthens the habit.
  3. Print this sheet and keep it beside your keyboard. Cross off shortcuts once you use them without thinking.
  4. Add three more each week. In a month you will know a dozen, which covers most daily work.

Why shortcuts and touch typing go together

Shortcuts only save time when your fingers find the keys without looking. Touch typists learn shortcuts faster because Ctrl, Shift, Alt and the letter keys are already mapped to fingers. If you still look down for modifier keys, a few typing lessons will make every shortcut on this page faster.

Printing this page

Use Ctrl + P (Cmd + P on Mac). The header, footer and ads are removed automatically so the cheat sheet prints cleanly on one or two pages.

Text editing shortcuts every typist should know

ActionWindows and LinuxMac
Delete the previous wordCtrl + BackspaceOption + Delete
Move one word left or rightCtrl + Left or Right arrowOption + Left or Right arrow
Jump to start or end of lineHome or EndCmd + Left or Right arrow
Select one word at a timeCtrl + Shift + arrowOption + Shift + arrow
Select to start or end of lineShift + Home or EndCmd + Shift + arrow
Undo / redoCtrl + Z / Ctrl + YCmd + Z / Cmd + Shift + Z

These work in almost every app, from email to code editors, and combine with fast typing to save far more time than any single app shortcut.

Frequently asked questions

How can I remember keyboard shortcuts?

Learn two or three at a time and use them on purpose for a week before adding more. Printing this sheet and keeping it next to your keyboard helps.

Do these VS Code shortcuts work on every version?

These are long-standing defaults for Visual Studio Code on Windows and Linux (use Cmd on Mac). A few can differ by version, language or custom settings.