General
| Shortcut | Action |
|---|---|
| Ctrl + Shift + P | Command Palette |
| Ctrl + P | Quick Open a file |
| Ctrl + , | Settings |
| Ctrl + ` | Toggle the terminal |
| Ctrl + B | Toggle the sidebar |
| Ctrl + K, Ctrl + S | Keyboard shortcuts editor |
Editing
| Shortcut | Action |
|---|---|
| Ctrl + / | Toggle line comment |
| Alt + Up / Down | Move the line up or down |
| Shift + Alt + Up / Down | Copy the line up or down |
| Ctrl + Shift + K | Delete the line |
| Ctrl + D | Select the next occurrence |
| Ctrl + Shift + L | Select all occurrences |
| Alt + Click | Add a cursor |
| Shift + Alt + F | Format the document |
Navigation
| Shortcut | Action |
|---|---|
| F12 | Go to definition |
| F2 | Rename symbol |
| Ctrl + G | Go to line |
| Ctrl + Shift + F | Search across files |
| Ctrl + Tab | Switch between open editors |
How to learn keyboard shortcuts for good
- Pick three shortcuts you would use today. Ignore the rest for now.
- Use them on purpose for a week, even when the mouse feels quicker. Each use strengthens the habit.
- Print this sheet and keep it beside your keyboard. Cross off shortcuts once you use them without thinking.
- 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
| Action | Windows and Linux | Mac |
|---|---|---|
| Delete the previous word | Ctrl + Backspace | Option + Delete |
| Move one word left or right | Ctrl + Left or Right arrow | Option + Left or Right arrow |
| Jump to start or end of line | Home or End | Cmd + Left or Right arrow |
| Select one word at a time | Ctrl + Shift + arrow | Option + Shift + arrow |
| Select to start or end of line | Shift + Home or End | Cmd + Shift + arrow |
| Undo / redo | Ctrl + Z / Ctrl + Y | Cmd + 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.