Visual Studio Code Shortcut Keys - MacOS

Visual Studio Code Shortcut Keys - Windows

Visual Studio Code Shortcut Keys - macOS

Visual Studio Code (VS Code) is a very popular text editor for developers. Keyboard shortcuts prepared for macOS users speed up the coding process and increase productivity. In this article, we share all the shortcut keys of VS Code for macOS with you.

General Shortcuts

  • ⌘⇧P, F1: Show Command Palette
  • ⌘P: Quick Open, Go to File...
  • ⌘⇧N: New window/instance
  • ⌘⇧W: Close window/instance
  • ⌘,: User Settings
  • ⌘K ⌘S: Keyboard Shortcuts

Basic Editing Shortcuts

  • ⌘X: Cut line (empty selection)
  • ⌘C: Copy line (empty selection)
  • ⌥↑ / ↓: Move line up/down
  • ⇧⌥↑ / ↓: Copy line up/down
  • ⌘⇧K: Delete line
  • ⌘Enter: Insert line below
  • ⌘⇧Enter: Insert line above
  • ⌘⇧\: Go to matching bracket
  • ⌘[ / ]: Indent/outdent line
  • Home / End: Go to beginning/end of line
  • ⌘Home: Go to beginning of file
  • ⌘End: Go to end of file
  • ⌥PgUp / PgDn: Scroll page up/down
  • ⌘⇧[: Fold region
  • ⌘⇧]: Unfold region
  • ⌘K ⌘[: Fold all subregions
  • ⌘K ⌘]: Unfold all subregions
  • ⌘K ⌘0: Fold all regions
  • ⌘K ⌘J: Unfold all regions
  • ⌘K ⌘C: Add line comment
  • ⌘K ⌘U: Remove line comment
  • ⌘/: Toggle line comment
  • ⇧⌥A: Toggle block comment
  • ⌥Z: Toggle word wrap

Navigation Shortcuts

  • ⌘T: Show all symbols
  • ⌘G: Go to Line...
  • ⌘P: Go to File...
  • ⌘⇧O: Go to Symbol...
  • ⌘⇧M: Show problems panel
  • F8: Go to next error or warning
  • ⇧F8: Go to previous error or warning
  • ⌘⇧Tab: Navigate editor group history
  • ⌃- / ⌃⇧-: Go back / forward

Search and Replace Shortcuts

  • ⌘F: Find
  • ⌘H: Replace
  • ⌘G / ⇧⌘G: Find next/previous
  • ⌥Enter: Select all occurrences of find match
  • ⌘D: Add selection to next find match
  • ⌘K ⌘D: Move last selection to next find match
  • ⌥C / R / W: Toggle case-sensitive / regex / whole word options

Multi-cursor and Selection Shortcuts

  • ⌥ + Click: Add cursor
  • ⌥⌘↑ / ↓: Add cursor above/below
  • ⌘U: Undo last cursor operation
  • ⇧⌥I: Insert cursor at end of each selected line
  • ⌘L: Select current line
  • ⌘⇧L: Select all occurrences of current selection
  • ⌘F2: Select all occurrences of current word
  • ⇧⌥→: Expand selection
  • ⇧⌥←: Shrink selection
  • ⇧⌥ + Mouse Drag: Column (box) selection
  • ⇧⌥⌘ + Arrow Key: Column (box) selection
  • ⇧⌥⌘ + PgUp/PgDn: Column selection page up/down

Rich Language Editing Shortcuts

  • ⌘Space, ⌘I: Trigger suggestion
  • ⌘⇧Space: Trigger parameter hints
  • ⇧⌥F: Format document
  • ⌘K ⌘F: Format selection
  • F12: Go to definition
  • ⌥F12: Peek definition
  • ⌘K F12: Open definition to the side
  • ⌘.: Quick Fix
  • ⇧F12: Show references
  • F2: Rename symbol
  • ⌘K ⌘X: Trim trailing whitespace
  • ⌘K M: Change file language

Editor Management Shortcuts

  • ⌘W: Close editor
  • ⌘K F: Close folder
  • ⌘\: Split editor
  • ⌘1 / 2 / 3: Focus into '1', '2' or '3' editor group
  • ⌘K ⌘← / →: Focus into previous/next editor group
  • ⌘⇧PgUp / PgDn: Move editor left/right
  • ⌘K ← / →: Move active editor group

File Management Shortcuts

  • ⌘N: New File
  • ⌘O: Open File...
  • ⌘S: Save
  • ⌘⇧S: Save As...
  • ⌘K S: Save All
  • ⌘W: Close
  • ⌘K ⌘W: Close All
  • ⌘⇧T: Reopen closed editor
  • ⌘K Enter: Keep editor open in preview mode
  • ⌘Tab: Open next
  • ⌘⇧Tab: Open previous
  • ⌘P: Copy path of active file
  • ⌘R: Open past file in Finder
  • ⌘K O: Show active file in new window/instance

View Shortcuts

  • ⌃⌘F: Toggle full screen
  • ⇧⌥0: Change editor layout (horizontal/vertical)
  • ⌘= / ⌘-: Zoom in/out
  • ⌘B: Toggle sidebar
  • ⌘⇧E: Show Explorer / Focus
  • ⌘⇧F: Search
  • ⌘⇧G: Source Control
  • ⌘⇧D: Debug
  • ⌘⇧X: Extensions
  • ⌘⇧H: Replace in files
  • ⌘⇧J: Toggle search details
  • ⌘⇧U: Show output panel
  • ⌘⇧V: Open markdown preview
  • ⌘K V: Open markdown preview to the side
  • ⌘K Z: Zen Mode (Esc Esc to exit)

Debugging Shortcuts

  • F9: Toggle breakpoint
  • F5: Start/Continue
  • ⇧F5: Stop
  • F11 / ⇧F11: Step in / Step out
  • F10: Step over
  • ⌘K ⌘I: Show hover

Integrated Terminal Shortcuts

  • ⌃`: Show integrated terminal
  • ⌃⇧`: Create new terminal
  • ⌘C: Copy selection
  • ⌘V: Paste into active terminal
  • ⌘↑ / ↓: Scroll up/down
  • ⇧PgUp / PgDn: Scroll page up/down
  • ⌘Home / End: Scroll to top/bottom

These shortcuts will help you use Visual Studio Code more efficiently. For more shortcuts and details, you can visit the Visual Studio Code Keybindings page.