Master Visual Studio Code with these essential keyboard shortcuts. We cover shortcuts for Windows/Linux and macOS to help you code faster and more efficiently.
Legend
- Windows/Linux: Ctrl
- macOS: Cmd (⌘)
- Alt: Alt (Windows/Linux) / Option (⌥) (macOS)
Essential File & Navigation Shortcuts
File Operations
Action |
Windows/Linux |
macOS |
New File |
Ctrl + N |
Cmd + N |
Open File |
Ctrl + O |
Cmd + O |
Save File |
Ctrl + S |
Cmd + S |
Save As |
Ctrl + Shift + S |
Cmd + Shift + S |
Save All |
Ctrl + K, S |
Cmd + Option + S |
Close File |
Ctrl + W |
Cmd + W |
Close All Files |
Ctrl + K, Ctrl + W |
Cmd + K, Cmd + W |
Reopen Closed File |
Ctrl + Shift + T |
Cmd + Shift + T |
Quick Navigation
Action |
Windows/Linux |
macOS |
Quick Open (Go to File) |
Ctrl + P |
Cmd + P |
Command Palette |
Ctrl + Shift + P |
Cmd + Shift + P |
Go to Line |
Ctrl + G |
Cmd + G |
Go to Symbol |
Ctrl + Shift + O |
Cmd + Shift + O |
Go to Definition |
F12 |
F12 |
Peek Definition |
Alt + F12 |
Option + F12 |
Go Back |
Alt + ← |
Cmd + - |
Go Forward |
Alt + → |
Cmd + Shift + - |
Text Editing Shortcuts
Selection & Cursor
Action |
Windows/Linux |
macOS |
Select All |
Ctrl + A |
Cmd + A |
Select Line |
Ctrl + L |
Cmd + L |
Select Word |
Ctrl + D |
Cmd + D |
Select All Occurrences |
Ctrl + Shift + L |
Cmd + Shift + L |
Multi-cursor (Click) |
Alt + Click |
Option + Click |
Multi-cursor (Up/Down) |
Ctrl + Alt + ↑/↓ |
Cmd + Option + ↑/↓ |
Expand Selection |
Shift + Alt + → |
Shift + Option + → |
Shrink Selection |
Shift + Alt + ← |
Shift + Option + ← |
Text Manipulation
Action |
Windows/Linux |
macOS |
Copy Line |
Ctrl + C (no selection) |
Cmd + C (no selection) |
Cut Line |
Ctrl + X (no selection) |
Cmd + X (no selection) |
Duplicate Line |
Shift + Alt + ↓ |
Shift + Option + ↓ |
Move Line Up/Down |
Alt + ↑/↓ |
Option + ↑/↓ |
Delete Line |
Ctrl + Shift + K |
Cmd + Shift + K |
Insert Line Below |
Ctrl + Enter |
Cmd + Enter |
Insert Line Above |
Ctrl + Shift + Enter |
Cmd + Shift + Enter |
Join Lines |
Ctrl + J |
Cmd + J |
Formatting & Comments
Action |
Windows/Linux |
macOS |
Format Document |
Shift + Alt + F |
Shift + Option + F |
Format Selection |
Ctrl + K, Ctrl + F |
Cmd + K, Cmd + F |
Toggle Line Comment |
Ctrl + / |
Cmd + / |
Toggle Block Comment |
Shift + Alt + A |
Shift + Option + A |
Indent Line |
Ctrl + ] |
Cmd + ] |
Outdent Line |
Ctrl + [ |
Cmd + [ |
Search & Replace
Action |
Windows/Linux |
macOS |
Find |
Ctrl + F |
Cmd + F |
Find and Replace |
Ctrl + H |
Cmd + Option + F |
Find in Files |
Ctrl + Shift + F |
Cmd + Shift + F |
Replace in Files |
Ctrl + Shift + H |
Cmd + Shift + H |
Find Next |
F3 or Ctrl + G |
F3 or Cmd + G |
Find Previous |
Shift + F3 |
Shift + F3 |
Select All Matches |
Alt + Enter |
Option + Enter |
Window & Panel Management
Layout & Views
Action |
Windows/Linux |
macOS |
Toggle Sidebar |
Ctrl + B |
Cmd + B |
Toggle Terminal |
Ctrl + `` | `Cmd + ` `` |
|
Toggle Problems Panel |
Ctrl + Shift + M |
Cmd + Shift + M |
Toggle Output Panel |
Ctrl + Shift + U |
Cmd + Shift + U |
Focus Explorer |
Ctrl + Shift + E |
Cmd + Shift + E |
Focus Search |
Ctrl + Shift + F |
Cmd + Shift + F |
Focus Extensions |
Ctrl + Shift + X |
Cmd + Shift + X |
Tab Management
Action |
Windows/Linux |
macOS |
Next Tab |
Ctrl + Tab |
Cmd + Option + → |
Previous Tab |
Ctrl + Shift + Tab |
Cmd + Option + ← |
Close Tab |
Ctrl + W |
Cmd + W |
Reopen Closed Tab |
Ctrl + Shift + T |
Cmd + Shift + T |
Go to Tab (1-9) |
Ctrl + 1-9 |
Cmd + 1-9 |
Split Editor
Action |
Windows/Linux |
macOS |
Split Editor Right |
Ctrl + \ |
Cmd + \ |
Split Editor Down |
Ctrl + K, Ctrl + \ |
Cmd + K, Cmd + \ |
Focus Next Group |
Ctrl + K, Ctrl + → |
Cmd + K, Cmd + → |
Focus Previous Group |
Ctrl + K, Ctrl + ← |
Cmd + K, Cmd + ← |
Move Editor to Next Group |
Ctrl + Alt + → |
Cmd + Option + → |
Development Shortcuts
Code Intelligence
Action |
Windows/Linux |
macOS |
Show Hover |
Ctrl + K, Ctrl + I |
Cmd + K, Cmd + I |
Trigger Suggestion |
Ctrl + Space |
Cmd + Space |
Trigger Parameter Hints |
Ctrl + Shift + Space |
Cmd + Shift + Space |
Rename Symbol |
F2 |
F2 |
Show References |
Shift + F12 |
Shift + F12 |
Quick Fix |
Ctrl + . |
Cmd + . |
Debugging
Action |
Windows/Linux |
macOS |
Start/Continue Debugging |
F5 |
F5 |
Stop Debugging |
Shift + F5 |
Shift + F5 |
Restart Debugging |
Ctrl + Shift + F5 |
Cmd + Shift + F5 |
Step Over |
F10 |
F10 |
Step Into |
F11 |
F11 |
Step Out |
Shift + F11 |
Shift + F11 |
Toggle Breakpoint |
F9 |
F9 |
Terminal
Action |
Windows/Linux |
macOS |
New Terminal |
Ctrl + Shift + `` | `Cmd + Shift + ` `` |
|
Split Terminal |
Ctrl + Shift + 5 |
Cmd + Shift + 5 |
Focus Next Terminal |
Ctrl + PageDown |
Cmd + Shift + ] |
Focus Previous Terminal |
Ctrl + PageUp |
Cmd + Shift + [ |
Kill Terminal |
Ctrl + Shift + K |
Cmd + Shift + K |
Pro Tips for Maximum Efficiency
1. Master the Command Palette
Press Ctrl/Cmd + Shift + P
and type any command. This is the most powerful feature in VS Code - you can access almost any function through it.
2. Use Quick Open Effectively
Ctrl/Cmd + P
then type filename to quickly open files
- Add
:
after filename to go to a specific line
- Add
@
to search for symbols in the current file
- Add
#
to search for symbols across the workspace
3. Customize Your Shortcuts
Go to File > Preferences > Keyboard Shortcuts (or Ctrl/Cmd + K, Ctrl/Cmd + S
) to customize any shortcut to your preference.
4. Multi-cursor Magic
Use Ctrl/Cmd + D
to select the next occurrence of the current word, then edit multiple instances simultaneously. This is incredibly powerful for refactoring.
5. Zen Mode
Press Ctrl/Cmd + K, Z
to enter Zen Mode for distraction-free coding.
Essential Extensions Shortcuts
These shortcuts become available when you install popular extensions:
GitLens
Ctrl/Cmd + Shift + G, L
- Toggle GitLens
Bracket Pair Colorizer
- Better visual brackets (now built into VS Code)
Live Server
Alt + L, Alt + O
- Open with Live Server
Practice Exercise
Try this workflow to practice multiple shortcuts:
- Open Command Palette (
Ctrl/Cmd + Shift + P
)
- Create a new file (
Ctrl/Cmd + N
)
- Save it (
Ctrl/Cmd + S
)
- Duplicate a line (
Shift + Alt/Option + ↓
)
- Select all occurrences of a word (
Ctrl/Cmd + Shift + L
)
- Format the document (
Shift + Alt/Option + F
)
- Split the editor (
Ctrl/Cmd + \
)
Are you an android developer? Check out these 80+ Android Studio Shortcuts as well.