DEV Community

Cover image for The Ultimate Visual Studio Code Shortcuts Guide
Stevie G
Stevie G

Posted on • Edited on

The Ultimate Visual Studio Code Shortcuts Guide

Boost your productivity and streamline your workflow with these must-know Visual Studio Code shortcuts. Whether you're a beginner or a seasoned pro, these shortcuts will help you code faster and more efficiently.


1. Autocomplete

  • Windows/Mac: Tab When beginning to type, hit Tab to intelligently complete the displayed code.

2. Open Command Palette

  • Windows: Ctrl + Shift + P
  • Mac: Shift + Cmd + P

The Command Palette will quickly become your best friend as you learn various shortcuts. If you ever forget a shortcut, simply open the Command Palette and search for what you’re trying to do.


3. Find a File

  • Windows: Ctrl + P
  • Mac: Cmd + P

Quickly search for a specific file in the current workspace. This works really well in conjunction with the split editor. Hit Cmd + P (or Ctrl + P on Windows), and while continuing to hold the modifier key, keep hitting P to switch between recent files.


4. Toggle Sidebar

  • Windows: Ctrl + B
  • Mac: Cmd + B

Straightforward: quickly show or hide the sidebar.


5. Toggle Panel

  • Windows: Ctrl + J
  • Mac: Cmd + J

Quickly show or hide the bottom panel. This includes the Terminal, Output, Problems, and Debug Console.


6. Toggle Integrated Terminal

  • Windows/Mac: Ctrl + `

Quickly show or hide the integrated terminal panel.


7. Highlight Next Instance

  • Windows: Ctrl + D
  • Mac: Cmd + D

Select the next occurrence of the current word.


8. Highlight All Instances

  • Windows: Ctrl + F2
  • Mac: Fn + Cmd + F2

Select all occurrences of the current word.


9. Highlight All Occurrences of Selection

  • Windows: Ctrl + Shift + L
  • Mac: Cmd + Shift + L

Select all occurrences of the selected word.


10. Select a Line

  • Windows: Ctrl + L
  • Mac: Cmd + L

Select an entire line of code.


11. Comment/Uncomment a Line of Code

  • Windows/Mac: Ctrl + /

Comment or uncomment a line of code. This has intelligent language detection and will use the correct syntax for the current language, e.g., <!-- --> in HTML.


12. Move by Word

  • Windows: Ctrl + Left/Right Arrow Key
  • Mac: Option + Left/Right Arrow Key

Move by word using the left or right arrows while holding the modifier key.


13. Navigate Around Files

  • Windows: Ctrl + Up/Down/Left/Right Arrow Key
  • Mac: Cmd + Up/Down/Left/Right Arrow Key

Move to the top, bottom, left, or right extreme of the current file or code faster by holding the modifier key and using arrow keys.


14. Split Editor

  • Windows: Ctrl + \
  • Mac: Cmd + \

Split the current editor into two panes to view or edit files side by side.


15. Switch Between Tabs

  • Windows: Ctrl + Tab
  • Mac: Cmd + Tab

Quickly switch between open tabs in the editor.


16. Close Editor

  • Windows: Ctrl + W
  • Mac: Cmd + W

Close the current editor tab.


17. Open Settings

  • Windows: Ctrl + ,
  • Mac: Cmd + ,

Open the settings menu to tweak your VSCode configuration.


18. Open Keyboard Shortcuts

  • Windows: Ctrl + K, Ctrl + S
  • Mac: Cmd + K, Cmd + S

View and customise all the shortcuts available in VSCode.


19. Duplicate a Line

  • Windows: Shift + Alt + Down/Up Arrow
  • Mac: Shift + Option + Down/Up Arrow

Duplicate the current line or selection either above or below.


20. Delete a Line

  • Windows: Ctrl + Shift + K
  • Mac: Cmd + Shift + K

Delete the current line without needing to select it.


21. Move a Line Up or Down

  • Windows: Alt + Up/Down Arrow
  • Mac: Option + Up/Down Arrow

Move the current line (or selection) up or down in the editor.


22. Peek Definition

  • Windows: Alt + F12
  • Mac: Option + F12

View the definition of a method, variable, or function in a small popup without leaving the current file.


23. Go to Definition

  • Windows: F12
  • Mac: F12

Jump directly to the definition of a method, variable, or function in your project.


24. Rename Symbol

  • Windows: F2
  • Mac: F2

Rename all instances of a variable, method, or class in the workspace.


25. Format Document

  • Windows: Shift + Alt + F
  • Mac: Shift + Option + F

Automatically format your code using the language formatter.


26. Quick Fix

  • Windows: Ctrl + .
  • Mac: Cmd + .

Show available fixes or code suggestions for the current issue (e.g., linting errors).


27. Toggle Zen Mode

  • Windows: Ctrl + K Z
  • Mac: Cmd + K Z

Focus on your code by hiding all distractions like the sidebar, status bar, and activity bar.


28. Open Recent Workspace

  • Windows: Ctrl + R
  • Mac: Cmd + R

Quickly open recently accessed folders or workspaces.


29. Collapse All Folders

  • Windows: Ctrl + K Ctrl + 0
  • Mac: Cmd + K Cmd + 0

Collapse all folders in the Explorer view.


30. Expand All Folders

  • Windows: Ctrl + K Ctrl + J
  • Mac: Cmd + K Cmd + J

Expand all folders in the Explorer view.


Final Thoughts

If you’ve found any other shortcuts that have saved you time and effort, let me know in the comments below! Sharing is caring, and we all love a good productivity hack.

Top comments (0)