VS Code Shortcuts
— shortcuts, vs code — 2 min read
Key symbols: ⌘ ⇧ ⌥ ⌃
- Duplicate line:
Shift+Alt+Up/Down
- Duplicate the current line or selected lines above or below. - Open the command palette: ⌘ + shft + p - Access various VS Code commands and features quickly.
- Go to definition:
F12
- Navigate to the definition of the symbol under the cursor. - Find references:
Shift+F12
- Find all references of the symbol under the cursor. - Find all symbols in the file: ⌘ + SHIFT + 0 - List all symbols (such as functions, classes, or variables) in the current file.
- Find in files: ⌘ + SHIFT + F - Search for a specific text pattern throughout your project files.
- Find and replace in files: ⌘ + SHFT + H - Find and replace a specific text pattern throughout your project files.
- Save all: ⌥ ⌘ S
- Toggle line comment: ⌘ + / - Comment or uncomment the current line or selected lines.
- Toggle block comment:
Shift+Alt+A
- Comment or uncomment the current block (selected text) using block comments. - Move line up/down:
Alt+Up/Down
- Move the current line or selected lines up or down. - Go to line number: ^ + G - Quickly navigate to a specific line number.
- Go to previous/next error or warning:
F8
/Shift+F8
- Navigate through the errors and warnings in your code. - Multi-cursor selection: ⌘ + Click - Place multiple cursors in the editor for simultaneous editing.
- Expand/shrink selection:
^+Shift+Cmd+Right/Left
- Increase or decrease the current selection based on language semantics. - Format document:
Shift+Alt+F
- Automatically format your code based on the configured formatter. - Fold/unfold code: ⌘ + ALT + [ / ⌘ + ALT + ] - Collapse or expand code blocks, functions, or objects.
- Open shortcuts menu: ⌘ + K ⌘ + S
- Quick open: ⌘ + p - Quickly open any file in your project.
- Scroll up and down without moving cursor: fn + ⌃ + up / down arrow
Tab
- Copy path: ⌥ ⌘ C
Terminal
- Toggle terminal: ^ ` : Open or close the integrated terminal.
- Create a new terminal: ⇧ ^ `
- Navigate between terminal groups: ⇧ ⌘ ] or ⇧ ⌘ [
Window
- Focus the editor: ⌘ + 1