20 Must-Know VS Code Shortcuts (Mac and Windows)
Visual Studio Code (VS Code) is among the most popular code editors.
It's packed with powerful features that can speed up your development workflow.
But are you taking full advantage of what it has to offer?
For both Mac and Windows, here's a list of 20 VS Code shortcuts that every developer should know (or at least have for reference).
Small improvements over time can add up to massive productivity gains. 🦾
Quick note for clarity: the +
indicates "and" the command. So as an example, Command + Shift + P
would be the same as me saying for you to press ⌘
, Shift
and P
all at the same time.
Note for Mac users:
- ⌘ = Command (or Cmd)
- ⇧ = Shift
- ⌥ = Option (or Alt)
- ⌃ = Control (or Ctrl)
1. Open Command Palette
Your Gateway to Everything in VS Code
- Mac:
Command + Shift + P
- Windows:
Ctrl + Shift + P
You can also just hitF12
2. Open File
Find and Open Files Like a Pro
- Mac:
Command + P
- Windows:
Ctrl + P
3. Close Editor
Quickly Close the Current File
- Mac:
Command + W
- Windows:
Ctrl + W
4. Find and Replace
Search and Modify Your Code Efficiently
- Mac:
Command + F
(Find),Command + Option + F
(Replace) - Windows:
Ctrl + F
(Find),Ctrl + H
(Replace)
5. Toggle Sidebar Visibility
Clean Up Your Workspace
- Mac:
Command + B
- Windows:
Ctrl + B
6. Toggle Integrated Terminal
Command Line Access at Your Fingertips
- Mac:
Command + `
- Windows:
Ctrl + `
7. Toggle Line Comment
Comment Like a Ninja. Select the line you want to comment and then:
- Mac:
Command + /
- Windows:
Ctrl + /
8. Select All Occurrences of Find Match
Edit Multiple Instances at Once
- Mac:
Command + Shift + L
- Windows:
Ctrl + Shift + L
9. Create a New Terminal
Multiple Terminals for Maximum Productivity
- Mac:
Control + Shift + `
- Windows:
Ctrl + Shift + `
10. Jump to Matching Bracket - Never Lose Track of Your Brackets
- Mac:
Command + Shift + \
- Windows:
Ctrl + Shift + \
11. Jump to Matching Bracket
Never Lose Track of Your Brackets
- Mac:
Command + Shift + \
- Windows:
Ctrl + Shift + \
12. Split Editor
Divide Your Editor Into Multiple Panels
- Mac:
Command + \
- Windows:
Ctrl + \
13. Show Git Changes
View All Changes Made to the File Since the Last Git Commit
- Mac:
Command + K Command + G
- Windows:
Ctrl + K Ctrl + G
14. Duplicate Line
Copy the Current Line or Selection
- Mac:
Command + D
- Windows:
Ctrl + D
15. Delete Line
Remove the Current Line or Selection
- Mac:
Command + Shift + K
- Windows:
Ctrl + Shift + K
16. Navigate to Back/Forward to Edit Location
Handy for remembering where you were. Return to Where You Last Made Changes
- Mac:
Control + -
/Control + Shift + -
- Windows:
Alt + ←
/Alt + →
17. Format Document
Automatically Format Your Code
- Mac:
Shift + Option + F
- Windows:
Shift + Alt + F
18. Move Line Up/Down
Reorder Your Code Lines Quickly
- Mac:
Option + Up/Down Arrow
- Windows:
Alt + Up/Down Arrow
19. Switch Between Tabs
Move Between Open Editor Tabs
- Mac:
Control + Tab
- Windows:
Ctrl + Tab
20. Expand/Shrink Selection
Select Code Logically by Expansion
- Mac:
Control + Shift + Command + Right/Left Arrow
- Windows:
Ctrl + Shift + Alt + Right/Left Arrow
These shortcuts are just the tip of the iceberg when it comes to enhancing your workflow in VS Code.
Spend some time with them, try to memorize the ones that align with your usual tasks, and see how they can transform your coding experience. 🚀
Happy coding! ✌️
Follow me on Twitter or connect on LinkedIn.
🚨 Want to make friends and learn from peers? You can join our free web developer community here. 🎉