My Favorite Shortcuts for VS Code

Feb 2, 2024 06:30 · 95 words · 1 minute read

General advice: You can access a list of all keyboard shortcuts via the “Preferences: Open Keyboard Shortcuts” menu (shortcut: ⌘+K, ⌘+S.

Essentials

  • ⌘+Shift ⇧+P: Show all commands (and search through them)
  • F12: Go to Definition
  • ⌥+F5: Go to Next Change
    • Likewise, ⌥+⇧+F5 lets you “Go to Previous Change”
  • ⌃+-: Go back (go to last cursor position)
    • Likewise, ⌃+⇧+- lets you “Go forward (navigate to the next cursor position)”

Selecting

  • ⌃+⇧+← / → lets you un-expand/expand the selection (e.g. for selecting the whole word, the whole method…)

Refactoring

  • F2: Rename symbol (e.g. variable, class, method…)