Top Visual Studio Code Shortcuts to Boost Your Productivity
Visual Studio Code (VS Code) is one of the most popular code editors among developers, thanks to its lightweight design, extensive extension support, and customizable interface. To supercharge your coding efficiency, mastering keyboard shortcuts is essential. This article covers the top VS Code shortcuts for navigation, editing, debugging, and more, helping you work faster and smarter. Shortcuts are provided for both Windows/Linux and Mac, where they differ. Why Use Shortcuts in VS Code? Keyboard shortcuts reduce reliance on the mouse, streamline repetitive tasks, and keep your focus on coding. Whether you're a beginner or a seasoned developer, these shortcuts will save you time and enhance your workflow. Getting Started To view or customize shortcuts in VS Code: Open the Keyboard Shortcuts panel: Ctrl + K, Ctrl + S (Windows/Linux) or Cmd + K, Cmd + S (Mac). Search for commands or modify keybindings by clicking the pencil icon next to a shortcut. Use the Command Palette (Ctrl + Shift + P or Cmd + Shift + P) to run any VS Code command. Now, let’s dive into the most useful shortcuts, organized by category. General Navigation These shortcuts help you move around VS Code quickly. Action Windows/Linux Mac Description Open Command Palette Ctrl + Shift + P Cmd + Shift + P Access any VS Code command or setting. Quick File Open Ctrl + P Cmd + P Search and open files by name. Toggle Sidebar Ctrl + B Cmd + B Show or hide the sidebar (Explorer, Search, etc.). Open New Window Ctrl + Shift + N Cmd + Shift + N Launch a new VS Code instance. Close Window Ctrl + Shift + W Cmd + Shift + W Close the current VS Code window. File and Editor Management Manage files, tabs, and editor layouts with ease. Action Windows/Linux Mac Description New File Ctrl + N Cmd + N Create a new untitled file. Save File Ctrl + S Cmd + S Save the current file. Close Editor Ctrl + W or Ctrl + F4 Cmd + W Close the active editor tab. Split Editor Ctrl + \ Cmd + \ Split the editor into multiple panes. Switch Editor Tab Ctrl + Tab Cmd + Tab Cycle through open editor tabs. Code Editing These shortcuts streamline writing and refactoring code. Action Windows/Linux Mac Description Comment Line Ctrl + / Cmd + / Toggle line comment for the selected line(s). Multi-Cursor Selection Alt + Click Option + Click Add multiple cursors for simultaneous editing. Select Next Occurrence Ctrl + D Cmd + D Select the next occurrence of the current word. Format Document Ctrl + Shift + I Cmd + Shift + I Auto-format the entire file (if supported by the language). Go to Definition F12 F12 Jump to the definition of a variable or function. Search and Replace Find and modify code across files efficiently. Action Windows/Linux Mac Description Find in File Ctrl + F Cmd + F Search within the current file. Replace in File Ctrl + H Cmd + H Replace text within the current file. Search in Project Ctrl + Shift + F Cmd + Shift + F Search across all files in the workspace. Go to Line Ctrl + G Cmd + G Jump to a specific line number. Find Symbol Ctrl + Shift + O Cmd + Shift + O Search for symbols (functions, classes) in the current file. Debugging Speed up debugging with these shortcuts. Action Windows/Linux Mac Description Start Debugging F5 F5 Begin or continue debugging. Step Over F10 F10 Step over the next line of code. Step Into F11 F11 Step into a function call. Toggle Breakpoint F9 F9 Add or remove a breakpoint on the current line. Stop Debugging Shift + F5 Shift + F5 End the debugging session. Terminal and Version Control Work with the integrated terminal and Git directly in VS Code. Action Windows/Linux Mac Description Toggle Terminal Ctrl + ` Cmd + ` Show or hide the integrated terminal. New Terminal Ctrl + Shift + `

Visual Studio Code (VS Code) is one of the most popular code editors among developers, thanks to its lightweight design, extensive extension support, and customizable interface. To supercharge your coding efficiency, mastering keyboard shortcuts is essential. This article covers the top VS Code shortcuts for navigation, editing, debugging, and more, helping you work faster and smarter. Shortcuts are provided for both Windows/Linux and Mac, where they differ.
Why Use Shortcuts in VS Code?
Keyboard shortcuts reduce reliance on the mouse, streamline repetitive tasks, and keep your focus on coding. Whether you're a beginner or a seasoned developer, these shortcuts will save you time and enhance your workflow.
Getting Started
To view or customize shortcuts in VS Code:
- Open the Keyboard Shortcuts panel: Ctrl + K, Ctrl + S (Windows/Linux) or Cmd + K, Cmd + S (Mac).
- Search for commands or modify keybindings by clicking the pencil icon next to a shortcut.
- Use the Command Palette (Ctrl + Shift + P or Cmd + Shift + P) to run any VS Code command.
Now, let’s dive into the most useful shortcuts, organized by category.
General Navigation
Action | Windows/Linux | Mac | Description |
---|---|---|---|
Open Command Palette | Ctrl + Shift + P | Cmd + Shift + P | Access any VS Code command or setting. |
Quick File Open | Ctrl + P | Cmd + P | Search and open files by name. |
Toggle Sidebar | Ctrl + B | Cmd + B | Show or hide the sidebar (Explorer, Search, etc.). |
Open New Window | Ctrl + Shift + N | Cmd + Shift + N | Launch a new VS Code instance. |
Close Window | Ctrl + Shift + W | Cmd + Shift + W | Close the current VS Code window. |
File and Editor Management
Action | Windows/Linux | Mac | Description |
---|---|---|---|
New File | Ctrl + N | Cmd + N | Create a new untitled file. |
Save File | Ctrl + S | Cmd + S | Save the current file. |
Close Editor | Ctrl + W or Ctrl + F4 | Cmd + W | Close the active editor tab. |
Split Editor | Ctrl + \ | Cmd + \ | Split the editor into multiple panes. |
Switch Editor Tab | Ctrl + Tab | Cmd + Tab | Cycle through open editor tabs. |
Code Editing
Action | Windows/Linux | Mac | Description |
---|---|---|---|
Comment Line | Ctrl + / | Cmd + / | Toggle line comment for the selected line(s). |
Multi-Cursor Selection | Alt + Click | Option + Click | Add multiple cursors for simultaneous editing. |
Select Next Occurrence | Ctrl + D | Cmd + D | Select the next occurrence of the current word. |
Format Document | Ctrl + Shift + I | Cmd + Shift + I | Auto-format the entire file (if supported by the language). |
Go to Definition | F12 | F12 | Jump to the definition of a variable or function. |
Search and Replace
Action | Windows/Linux | Mac | Description |
---|---|---|---|
Find in File | Ctrl + F | Cmd + F | Search within the current file. |
Replace in File | Ctrl + H | Cmd + H | Replace text within the current file. |
Search in Project | Ctrl + Shift + F | Cmd + Shift + F | Search across all files in the workspace. |
Go to Line | Ctrl + G | Cmd + G | Jump to a specific line number. |
Find Symbol | Ctrl + Shift + O | Cmd + Shift + O | Search for symbols (functions, classes) in the current file. |
Debugging
Action | Windows/Linux | Mac | Description |
---|---|---|---|
Start Debugging | F5 | F5 | Begin or continue debugging. |
Step Over | F10 | F10 | Step over the next line of code. |
Step Into | F11 | F11 | Step into a function call. |
Toggle Breakpoint | F9 | F9 | Add or remove a breakpoint on the current line. |
Stop Debugging | Shift + F5 | Shift + F5 | End the debugging session. |
Terminal and Version Control
Action | Windows/Linux | Mac | Description |
---|---|---|---|
Toggle Terminal | Ctrl + ` |
Cmd + ` |
Show or hide the integrated terminal. |
New Terminal | Ctrl + Shift + ` |
Cmd + Shift + ` |
Create a new terminal instance. |
Git Commit | Ctrl + Enter (in Source Control) | Cmd + Enter | Commit staged changes (with Git extension). |
Stage Changes | Ctrl + Shift + G, +
|
Cmd + Shift + G, +
|
Stage selected changes for commit. |
Open Source Control | Ctrl + Shift + G | Cmd + Shift + G | Switch to the Source Control view. |
Customizing Shortcuts
If a shortcut doesn’t suit you, customize it:
- Open the Keyboard Shortcuts panel (Ctrl + K, Ctrl + S or Cmd + K, Cmd + S).
- Search for the command (e.g., "toggle terminal").
- Click the pencil icon and press your preferred key combination.
- Save changes to update the keybinding.
You can also export/import keybindings for use across machines by copying the keybindings.json file from your VS Code user settings folder.
Tips for Learning Shortcuts
- Start Small: Focus on 2-3 shortcuts per day (e.g., Ctrl + P, Ctrl + /, Ctrl + D).
- Use Cheat Sheets: Print or bookmark a VS Code shortcut cheat sheet for quick reference.
- Practice Regularly: Repetition builds muscle memory. Try using shortcuts instead of menus for a week.
- Enable Tips: Turn on the Screencast Mode (Ctrl + K, Ctrl + S > search "screencast") to display key presses on-screen while learning.
Platform-Specific Notes
Windows/Linux: Most shortcuts use Ctrl, but some Linux distributions may conflict with system keybindings. Check your OS settings to resolve conflicts.
Mac: Replace Ctrl with Cmd and Alt with Option in most cases. Mac users may need to adjust keybindings for function keys (F1-F12).
Conclusion
VS Code shortcuts can transform your coding experience, making you faster and more efficient. Start with the shortcuts that align with your daily tasks, such as navigation and editing, and gradually incorporate debugging and version control commands. Refer to this guide or VS Code’s built-in shortcut panel to keep learning.