According to the Stack Overflow surveys, Visual Studio Code is the most widely used editor among developers, and knowing its shortcuts saves you hundreds of clicks a day. Here are the most useful ones!
On macOS: in almost every shortcut
CtrlbecomesCmdandAltbecomesOption. Where the shortcut is different, it is shown in brackets.
1. Basic Editing#
Ctrl + C / Ctrl + X - copy or cut the whole line (with no selection)
Ctrl + Shift + K - delete the current line
Alt + ↑ / ↓ - move the current line up or down
Shift + Alt + ↑ / ↓ - duplicate the current line up or down (Linux: Ctrl + Shift + Alt + ↑ / ↓)
Ctrl + Enter - insert a line below
Ctrl + Shift + Enter - insert a line above
Ctrl + / - comment / uncomment the line
Ctrl + ] / Ctrl + [ - indent / outdent the line
2. Multi-cursor and Selection#
Alt + Click - add a cursor where you click
Ctrl + Alt + ↑ / ↓ - add a cursor above or below (macOS: Cmd + Option + ↑ / ↓; Linux: Shift + Alt + ↑ / ↓)
Ctrl + D - select the next occurrence of the current word
Ctrl + Shift + L - select all occurrences of the current selection
Shift + Alt + → - expand the selection (word → string → block) (macOS: Ctrl + Shift + Cmd + →)
3. Navigation#
Ctrl + P - go to file (quick search by name)
Ctrl + G - go to line number… (macOS: Ctrl + G)
Ctrl + Shift + O - go to a symbol (function, class, variable) in the file
F12 - go to definition
Alt + F12 - peek definition (without opening the file) (macOS: Option + F12)
Shift + F12 - show all references to a symbol
Ctrl + Home / Ctrl + End - go to the beginning / end of the file (macOS: Cmd + ↑ / Cmd + ↓)
Ctrl + Tab - switch between open files (macOS: Ctrl + Tab)
4. Window and View Management#
Ctrl + B - show / hide the sidebar
Ctrl + \ - split the editor (split view)
Ctrl + 1, 2, 3 - focus editor group 1, 2 or 3
Ctrl + W - close the current tab
Ctrl + Shift + E - show the Explorer (files)
Ctrl + Shift + F - search across all files
Ctrl + ` (backtick) - show / hide the integrated terminal (macOS: Ctrl + ` )
5. Commands and Refactoring#
Ctrl + Shift + P (or F1) - Command Palette: run any VS Code command
F2 - rename a symbol (variable, function) across the whole project
Ctrl + . - Quick Fix (suggestions for errors or missing imports)
Shift + Alt + F - format the document (Linux: Ctrl + Shift + I)
Ctrl + Space - trigger IntelliSense suggestions (macOS: Ctrl + Space)
Bonus: Zen Mode and the Full Map#
Ctrl + K Z - enable Zen Mode to focus on the code only (press Esc twice to exit)
Ctrl + K Ctrl + S - open the list of all shortcuts, where you can search and customize them
Learn 2-3 of these shortcuts a week and watch your productivity soar!




