Internet and social

VS Code Keyboard Shortcuts for Windows and Mac

Keyboard shortcuts to boost productivity on VS Code

12views

Key Takeaways:

  • Use Ctrl + Shift + P to open the command palette and Ctrl + K or Ctrl + S to open all keyboard shortcuts and commands.
  • Programmers can significantly improve productivity by using keyboard shortcuts instead of constantly using a mouse.
  • VS code supports various keyboard shortcuts useful to Windows and Mac users.

Keyboard Shortcuts for Windows

Navigation

  • Ctrl + P: Open the Command Palette.
  • Ctrl + Tab: Switch between open editors.
  • Ctrl + Shift + Tab: Switch between open editors in reverse order.
  • Ctrl + W: Close the active editor.
  • Ctrl + Shift + W: Close all editors.
  • Ctrl + 1, Ctrl + 2, Ctrl + 3…: Switch between open groups.

Editing

  • Ctrl + X: Cut selected text.
  • Ctrl + C: Copy selected text.
  • Ctrl + V: Paste copied text.
  • Ctrl + Z: Undo.
  • Ctrl + Y: Redo.
  • Ctrl + A: Select all text.
  • Ctrl + Shift + L: Select all occurrences of the selected word.
  • Ctrl + D: Add the next cursor.
  • Ctrl + Shift + D: Delete the current cursor.
  • Ctrl + Shift + K: Delete the current line.
  • Ctrl + [: Indent lines.
  • Ctrl + ]: Outdent lines.

Code Navigation

  • Ctrl + P: Open the Go to File/Symbol dialog.
  • Ctrl + T: Open the Navigate to Symbol dialog.
  • Ctrl + Shift + O: Open the Open Settings (JSON) dialog.
  • Ctrl + G: Go to a specific line number.
  • Ctrl + F: Find in the current file.
  • Ctrl + Shift + F: Find in files.
  • F2: Rename symbol.

Code Editing

  • Ctrl + Shift + F: Format selection.
  • Ctrl + K, Ctrl + D: Comment/uncomment selected lines.
  • Ctrl + Shift + V: Paste and indent code.
  • Ctrl + K, Ctrl + 0: Fold code regions.
  • Ctrl + K, Ctrl + J: Unfold code regions.

Other Useful Shortcuts

  • Ctrl + Shift + P: Open the Command Palette (access all commands).
  • Ctrl + `: Show/hide the integrated terminal.
  • Ctrl + Shift + X: Open the Extensions view.
  • Ctrl + Shift + E: Show the Explorer view.
  • Ctrl + Shift + U: Show the Git panel.
  • Ctrl + Shift + B: Build the current project.
  • F5: Start debugging.

Keyboard Shortcuts for Mac

Navigation

  • + P: Open Command Palette (access all commands)
  • + N: New File
  • + O: Open File
  • + Shift + N: New Window
  • + W: Close Window
  • + Tab: Switch between open editors
  • + Shift + Tab: Switch between open editors in reverse order

Editing

  • + X: Cut
  • + C: Copy
  • + V: Paste
  • + Z: Undo
  • ⇧⌘ + Z: Redo
  • + A: Select All
  • + D: Add cursor to next matching selection
  • + Shift + K: Delete current line
  • + [ : Indent
  • ⌘ + ]: Outdent
  • + /: Toggle comment

Code Navigation

  • + P: Open Go to File/Symbol dialog
  • + T: Open Navigate to Symbol dialog
  • + Shift + O: Open Settings (JSON)
  • + G: Go to line
  • + F: Find
  • + Shift + F: Find in files
  • F2: Rename symbol
  • + Click: Go to definition

Code Editing

  • + Shift + I: Format document
  • + or + : Move cursor by word
  • + or + : Move the cursor to the beginning/end of the line
  • + Delete or + Backspace: Delete word to the right/left
  • + Shift + [ : Fold code regions
  • + Shift + ]: Unfold code regions

Debugging

  • F5: Start debugging
  • F9: Toggle breakpoint
  • F10: Step over
  • F11: Step into
  • + F11: Step out
  • + Shift + F5: Stop debugging

Terminal

  • + `: Open the integrated terminal

The keyboard shortcuts outlined in this guide are just some of the more commonly used shortcuts on VS Code. There are many other shortcuts you can explore.

If you found this post useful, you will also like this guide on ways to improve productivity with Chrome.

Leave a Response

David Ogbor
David is a tech guru with extensive knowledge in technical articles. He is passionate about writing and presents technical articles in an easy-to-understand format for easy comprehension. He aims to present easy solutions for day-to-day problems encountered while using PC. In his spare time, he likes traveling, playing sports, and singing.