Visual Studio Code Keyboard Shortcuts — Complete Cheatsheet
Visual Studio Code is a powerful and versatile code editor. Mastering its keyboard shortcuts is crucial for maximizing your productivity and streamlining your development workflow.
RECOMMENDED
Upgrade Your Workflow: MX Master 3S Mouse
Pair your shortcuts with the ultimate developer mouse. Silent clicks, 8K DPI tracking, and hyper-fast scrolling.
Shortcuts
| Action | Windows | Mac | Category |
|---|---|---|---|
| Open Command Palette | Ctrl+Shift+P | Cmd+Shift+P | General |
| Quick Open, Go to File | Ctrl+P | Cmd+P | Navigation |
| Save File | Ctrl+S | Cmd+S | File Management |
| Save All Files | Ctrl+K S | Cmd+K S | File Management |
| New File | Ctrl+N | Cmd+N | File Management |
| Close Editor | Ctrl+W | Cmd+W | File Management |
| Cut Line/Selection | Ctrl+X | Cmd+X | Editing |
| Copy Line/Selection | Ctrl+C | Cmd+C | Editing |
| Paste | Ctrl+V | Cmd+V | Editing |
| Undo | Ctrl+Z | Cmd+Z | Editing |
| Redo | Ctrl+Y | Cmd+Shift+Z | Editing |
| Find | Ctrl+F | Cmd+F | Search |
| Replace | Ctrl+H | Cmd+Option+F | Search |
| Find in Files | Ctrl+Shift+F | Cmd+Shift+F | Search |
| Toggle Line Comment | Ctrl+/ | Cmd+/ | Editing |
| Toggle Block Comment | Shift+Alt+A | Shift+Option+A | Editing |
| Format Document | Shift+Alt+F | Shift+Option+F | Editing |
| Go to Definition | F12 | F12 | Navigation |
| Go to Line... | Ctrl+G | Cmd+G | Navigation |
| Toggle Terminal | Ctrl+` | Ctrl+` | Terminal |
| Open Explorer | Ctrl+Shift+E | Cmd+Shift+E | View |
| Open Search | Ctrl+Shift+F | Cmd+Shift+F | View |
| Open Source Control | Ctrl+Shift+G | Cmd+Shift+G | View |
| Open Debug | Ctrl+Shift+D | Cmd+Shift+D | View |
Tips
- Practice makes perfect: Regularly use shortcuts to build muscle memory. Start with a few common ones and gradually add more.
- Explore the Command Palette (Ctrl+Shift+P / Cmd+Shift+P): If you forget a shortcut, the Command Palette is your best friend for finding and executing commands.
- Customize your shortcuts: Tailor VS Code to your workflow by remapping existing shortcuts or creating new ones for frequently used commands.
- Use multi-cursor editing: Master Alt+Click (Windows/Linux) or Option+Click (Mac) to place multiple cursors for simultaneous editing, a huge time-saver.
Frequently Asked Questions
How do I see all Visual Studio Code shortcuts?
You can view all default and custom shortcuts by opening the Keyboard Shortcuts editor. Press Ctrl+K Ctrl+S (Windows/Linux) or Cmd+K Cmd+S (Mac).
Can I customise Visual Studio Code shortcuts?
Yes, absolutely! Open the Keyboard Shortcuts editor (Ctrl+K Ctrl+S or Cmd+K Cmd+S). You can search for commands and then click the pencil icon to assign a new keybinding.