VS Code Keyboard Shortcuts
The Visual Studio Code shortcuts worth learning first: command palette, multi-cursor, search, terminal and refactoring.
VS Code Keyboard Shortcuts — 20 shortcuts
Action
Windows
Mac
Command palette
WindowsCtrl+Shift+P
Mac⌘ Cmd+⇧ Shift+P
Go to file
WindowsCtrl+P
Mac⌘ Cmd+P
Toggle the terminal
WindowsCtrl+`
Mac⌃ Control+`
Comment out a line
WindowsCtrl+/
Mac⌘ Cmd+/
Duplicate the line
WindowsShift+Alt+↓
Mac⌥ Option+⇧ Shift+↓
Format the document
WindowsShift+Alt+F
Mac⌥ Option+⇧ Shift+F
Add cursor below
WindowsCtrl+Alt+↓
Mac⌥ Option+⌘ Cmd+↓
Rename every occurrence
WindowsF2
MacF2
Save every open file
WindowsCtrl+K,S
Mac⌥ Option+⌘ Cmd+S
Split the editor
WindowsCtrl+\
Mac⌘ Cmd+\
Toggle the sidebar
WindowsCtrl+B
Mac⌘ Cmd+B
Search across all files
WindowsCtrl+Shift+F
Mac⌘ Cmd+⇧ Shift+F
Go to a line number
WindowsCtrl+G
Mac⌃ Control+G
Go to definition
WindowsF12
MacF12
Move the line up
WindowsAlt+↑
Mac⌥ Option+↑
Select the next occurrence
WindowsCtrl+D
Mac⌘ Cmd+D
Select all occurrences
WindowsCtrl+Shift+L
Mac⌘ Cmd+⇧ Shift+L
Trigger autocomplete
WindowsCtrl+Space
Mac⌃ Control+Space
Quick fix
WindowsCtrl+.
Mac⌘ Cmd+.
Toggle word wrap
WindowsAlt+Z
Mac⌥ Option+Z
Frequently asked questions
What is the keyboard shortcut to command palette in VS Code?
On Windows, press Ctrl + Shift + P. On Mac, press Cmd + Shift + P.
What is the keyboard shortcut to go to file in VS Code?
On Windows, press Ctrl + P. On Mac, press Cmd + P.
What is the keyboard shortcut to toggle the terminal in VS Code?
On Windows, press Ctrl + `. On Mac, press Control + `.
What is the keyboard shortcut to comment out a line in VS Code?
On Windows, press Ctrl + /. On Mac, press Cmd + /.
What is the keyboard shortcut to duplicate the line in VS Code?
On Windows, press Shift + Alt + Down. On Mac, press Option + Shift + Down.