Introduction
Visual Studio Code (VSCode) is a powerful and popular code editor developed by Microsoft. It supports a wide range of programming languages and offers numerous features to boost your coding productivity. Mastering VSCode keyboard shortcuts is essential for maximizing efficiency. This cheat sheet provides a quick reference to the most commonly used shortcuts for macOS.
VSCode Keyboard Shortcuts Cheat Sheet for macOS
General
Action |
macOS |
Show Command Palette |
⇧⌘P , F1 |
Quick Open |
⌘P |
New window |
⇧⌘N |
Close window |
⌘W |
User Settings |
⌘, |
Keyboard Shortcuts |
⌘K ⌘S |
Basic Editing
Action |
macOS |
Cut line (empty selection) |
⌘X |
Copy line (empty selection) |
⌘C |
Move line up/down |
⌥↑ / ⌥↓ |
Copy line up/down |
⇧⌥↑ / ⇧⌥↓ |
Delete line |
⇧⌘K |
Insert line below |
⌘Enter |
Insert line above |
⇧⌘Enter |
Jump to matching bracket |
⇧⌘\ |
Indent/outdent line |
⌘] / ⌘[ |
Go to beginning/end of line |
⌘← / ⌘→ |
Go to beginning/end of file |
⌘↑ / ⌘↓ |
Scroll line up/down |
⌃Page Up / ⌃Page Down |
Scroll page up/down |
⌘Page Up /⌘Page Down |
Fold region |
⌥⌘[ |
Unfold region |
⌥⌘] |
Fold all subregions |
⌘K ⌘[ |
Unfold all subregions |
⌘K ⌘] |
Fold all regions |
⌘K ⌘0 |
Unfold all regions |
⌘K ⌘J |
Add line comment |
⌘K ⌘C |
Remove line comment |
⌘K ⌘U |
Toggle line comment |
⌘/ |
Toggle block comment |
⇧⌥A |
Toggle word wrap |
⌥Z |
Multi-cursor and Selection
Action |
macOS |
Insert cursor |
⌥ + click |
Insert cursor above |
⌥⌘↑ |
Insert cursor below |
⌥⌘↓ |
Undo last cursor operation |
⌘U |
Add cursor to end of each selected line |
⇧⌥I |
Select current line |
⌘L |
Select all occurrences of current selection |
⇧⌘L |
Select all occurrences of current word |
⌘F2 |
Expand selection |
⌃⇧⌘→ |
Shrink selection |
⌃⇧⌘← |
Column (box) selection |
⇧⌥ + drag mouse |
Column (box) selection up/down |
⇧⌥⌘↑ / ↓ |
Column (box) selection left/right |
⇧⌥⌘← / → |
Column (box) selection page up/down |
⇧⌥⌘Page Up / Page Down |
Search and Replace
Action |
macOS |
Find |
⌘F |
Replace |
⌥⌘F |
Find next |
⌘G |
Find previous |
⇧⌘G |
Select all occurrences of Find match |
⌥Enter |
Add selection to next Find match |
⌘D |
Move last selection to next Find match |
⌘K ⌘D |
Rich Languages Editing
Action |
macOS |
Trigger suggestion |
⌃Space , ⌘I |
Trigger parameter hints |
⇧⌘Space |
Format document |
⇧⌥F |
Format selection |
⌘K ⌘F |
Go to Definition |
F12 |
Peek Definition |
⌥F12 |
Open Definition to the side |
⌘K F12 |
Quick Fix |
⌘. |
Show References |
⇧F12 |
Rename Symbol |
F2 |
Trim trailing whitespace |
⌘K ⌘X |
Change file language |
⌘K M |
Navigation
Action |
macOS |
Show all Symbols |
⌘T |
Go to Line... |
⌃G |
Go to File... |
⌘P |
Go to Symbol... |
⇧⌘O |
Show Problems panel |
⇧⌘M |
Go to next error or warning |
F8 |
Go to previous error or warning |
⇧F8 |
Navigate editor group history |
⌃⇧Tab |
Go back |
⌃- |
Go forward |
⌃⇧- |
Toggle Tab moves focus |
⌃⇧M |
Editor Management
Action |
macOS |
Close editor |
⌘W |
Close folder |
⌘K F |
Split editor |
⌘\ |
Focus into 1st editor group |
⌘1 |
Focus into 2nd editor group |
⌘2 |
Focus into 3rd editor group |
⌘3 |
Focus into previous editor group |
⌘K ⌘← |
Focus into next editor group |
⌘K ⌘→ |
Move editor left |
⌘K ⇧⌘← |
Move editor right |
⌘K ⇧⌘→ |
Move active editor group left |
⌘K ← |
Move active editor group right |
⌘K → |
File Management
Action |
macOS |
New File |
⌘N |
Open File... |
⌘O |
Save |
⌘S |
Save As... |
⇧⌘S |
Save All |
⌥⌘S |
Close |
⌘W |
Close All |
⌘K ⌘W |
Reopen closed editor |
⇧⌘T |
Keep preview mode editor open |
⌘K Enter |
Open next |
⌃Tab |
Open previous |
⌃⇧Tab |
Copy path of active file |
⌘K P |
Reveal active file in Finder |
⌘K R |
Show active file in new window |
⌘K O |
Display
Action |
macOS |
Toggle full screen |
⌃⌘F |
Toggle editor layout (horizontal/vertical) |
⌥⌘0 |
Zoom in |
⌘= |
Zoom out |
⌘- |
Toggle Sidebar visibility |
⌘B |
Show Explorer / Toggle focus |
⇧⌘E |
Show Search |
⇧⌘F |
Show Source Control |
⌃⇧G |
Show Debug |
⇧⌘D |
Show Extensions |
⇧⌘X |
Replace in files |
⇧⌘H |
Toggle Search details |
⇧⌘J |
Show Output panel |
⇧⌘U |
Open Markdown preview |
⇧⌘V |
Open Markdown preview to the side |
⌘K V |
Zen Mode (Esc Esc to exit) |
⌘K Z |
Debug
Action |
macOS |
Toggle breakpoint |
F9 |
Start/Continue |
F5 |
Step into |
F11 |
Step out |
⇧F11 |
Step over |
F10 |
Stop |
⇧F5 |
Show hover |
⌘K ⌘I |
Integrated Terminal
Action |
macOS |
Show integrated terminal |
⌃` |
Create new terminal |
⌃⇧` |
Copy selection |
⌘C |
Scroll up/down |
⌘↑ / ⌘↓ |
Scroll page up/down |
Page Up / Page Down |
Scroll to top/bottom |
⌘Home / ⌘End |
Conclusion
This cheat sheet provides a quick reference to the most commonly used keyboard shortcuts in VSCode for macOS, helping you navigate and operate your development environment more efficiently. Keep this guide handy to enhance your productivity and streamline your coding workflow. Happy coding!
Comments
Post a Comment
Leave Comment