DEV Community

Cover image for VS Code Shortcuts to Boost Your Productivity
Thomas Lombart
Thomas Lombart

Posted on • Updated on

VS Code Shortcuts to Boost Your Productivity

Did you ever wanted to write code like a pro? To move chunks of code back and forth easily? Access whatever you want in the blink of an eye? Well, I did.

All the coding courses I took were recorded by instructors who seemed to know their code editor by heart. Seeing them slamming their keyboard and manipulating their code like pros made me think it was just ridiculous. That's when I decided to learn all the essential shortcuts of my favorite code editor: VS Code.

You'll find below all of the different shortcuts I use:

  • Open the command palette: ⇧ + ⌘ + P or Ctrl + Shift + P
  • Open keyboard shortcuts: ⌘ + K ⌘ + S or Ctrl + K Ctrl + S
  • Open user settings: ⌘ + , or Ctrl + ,

Editing

  • Undo: ⌘ + Z or Ctrl + Z
  • Redo: ⇧ + ⌘ + Z or Ctrl + Shift + Z
  • Remove one word: ⌥ + ⌫ or Ctrl + Backspace
  • Cut line: ⌘ + X or Ctrl + X
  • Copy line: ⌘ + C or Ctrl + C
  • Paste line: ⌘ + V or Ctrl + V
  • Delete line: ⇧ + ⌘ + K or Ctrl + Shift + K
  • Move line up/down: ⌥ + ↑/↓ or Alt + ↑/↓
  • Copy line up/down: ⇧ + ⌥ + ↑/↓ or Shift + Alt + ↑/↓
  • Toggle line commment: ⌘ + / or Ctrl + /

Selecting

  • Select the next/previous letter: ⇧ + →/← or Shift + →/←
  • Select the next/previous word: ⇧ + ⌥ + →/← or Ctrl + Shift + →/←
  • : Select current line / current and next line / etc : ⌘ + L / ⌘ + L ⌘ + L or Ctrl + L / Ctrl + L Ctrl + L
  • Select line up/down: ⇧ + ↑/↓ or Ctrl + Shift + ↑/↓
  • Select to the beginning/end of file: ⇧ + ⌘ + ↑/↓ or Ctrl + Shift + Home/End
  • Expand/Shrink selection: ⇧ + ⌃ + →/← or Shift + Alt + →/←

Navigating

  • Go to the next/previous word: ⌥ + → or Ctrl + →/←
  • Go to beginning/end of line: ⌘ + →/← or Home/End
  • Go to beginning/end of file: ⌘ + ↑/↓ or Ctrl + Home/End
  • Go to line: ⌃ + G or Ctrl + G
  • Go to file / Go to previous file: ⌘ + P / ⌘ + P ⌘ + P or Ctrl + P / Ctrl + P Ctrl + P
  • Open next opened tab: ⌃ + Tab or Ctrl + Tab
  • Go to symbol: ⇧ + ⌘ + O or Ctrl + Shift + O
  • Go to symbol in the workspace: ⌘ + T or Ctrl + T

Files

  • Save file: ⌘ + S or Ctrl + S
  • Close file: ⌘ + W or Ctrl + W
  • Close all files: ⌘ + K ⌘ + W or Ctrl + K Ctrl + W
  • Open previously closed: ⇧ + ⌘ + T or Ctrl + Shift + T

Search

  • Find: ⌘ + F or Ctrl + F
  • Replace: ⌘ + ⌥ + F or Ctrl + H
  • Find next/previous: ⌘ + G / ⇧ + ⌘ + G or Ctrl + F3 / Shift + Ctrl +F3

Cursors

  • Insert cursor: ⌥ + Click or Alt + Click
  • Insert cursor above: ⌥ + ⌘ + ↑/↓ or Ctrl + Alt + ↑
  • Select next match: ⌘ + D or Ctrl + D
  • De-select previous match: ⌘ + U or Ctrl + U
  • Select all occurrences of current word: ⇧ + ⌘ + L or Ctrl + Shift + L
  • Remove cursors: Escape

Display

  • Show Explorer: ⇧ + ⌘ + E or Ctrl + Shift + E
  • Show Search: ⇧ + ⌘ + F or Ctrl + Shift + F
  • Show Source Control: ⇧ + ⌃ + G or Ctrl + Shift + G
  • Show Debug: ⇧ + ⌘ + D or Ctrl + Shift + D: Show Debug
  • Show Extensions: ⇧ + ⌘ + X or Ctrl + Shift + X
  • Toggle Sidebar: ⌘ + B or Ctrl + B
  • Split editor: ⌘ + \ or Ctrl + \
  • Enter zen mode: ⌘ + K Z or Ctrl + K Z
  • Show (focus) integrated terminal: ⌃ + ` or Ctrl + `
  • Focus first/second/third editor window: ⌘ + 1 / ⌘ + 2 / ⌘ + 3 or Ctrl + 1 / Ctrl + 2 / Ctrl + 3

Alternatively, you can also check the official keyboard shortcuts of VS Code for macOS and for Windows.

Top comments (1)

Collapse
 
s0meon3 profile image
Gabriel Corrêa

Thanks, been looking for this for a while!