Skip to content
ioob.dev
Go back

VS Code: Frequently Used Shortcuts

· 5 min read
Table of contents

Table of contents

Command Palette

Every feature in VS Code is accessible through the Command Palette. Searching by name is always faster than digging through menus.

ActionMacWindows / Linux
Command Palettecommand(⌘) shift(⇧) PCtrl Shift P
Quick Open filecommand(⌘) PCtrl P
Open Settingscommand(⌘) ,Ctrl ,
Keyboard Shortcuts settingscommand(⌘) K, command(⌘) SCtrl K, Ctrl S
New windowcommand(⌘) shift(⇧) NCtrl Shift N
Close current tabcommand(⌘) WCtrl W

command(⌘) P has one trick beyond opening files. Press it twice in a row and it toggles to the previously opened file. Faster than clicking tabs when switching between two files.

command(⌘) shift(⇧) P (Command Palette) and command(⌘) P (Quick Open) are actually the same input box. command(⌘) shift(⇧) P opens it with > pre-filled, while command(⌘) P opens it empty. Type > in command(⌘) P to get the Command Palette, or type # to search symbols.

ActionMacWindows / Linux
Go to definitionF12F12
Peek definitionoption(⌥) F12Alt F12
Go to implementationcommand(⌘) F12Ctrl F12
Find referencesshift(⇧) F12Shift F12
Go to linecontrol(⌃) GCtrl G
Go to symbol in filecommand(⌘) shift(⇧) OCtrl Shift O
Navigate back / forwardcommand(⌘) option(⌥) ← / →Alt ← / →

option(⌥) F12 (Peek Definition) shows the definition inline without leaving the current file. If you just want a quick look before coming back, option(⌥) F12 is better than jumping to another file with F12. Press Esc to close when done.

command(⌘) shift(⇧) O (Go to Symbol in File) is faster than scrolling when looking for a specific function or class in a long file. Type : after opening to group symbols by kind.

Search & Replace

ActionMacWindows / Linux
Find in filecommand(⌘) FCtrl F
Replace in filecommand(⌘) HCtrl H
Find in projectcommand(⌘) shift(⇧) FCtrl Shift F
Replace in projectcommand(⌘) shift(⇧) HCtrl Shift H

The project-wide search (command(⌘) shift(⇧) F) groups results by file, making it easy to see the scope of impact at a glance. Click a line in the results panel to jump to that file, and project-wide replace can be applied selectively on a per-file basis.

Editing

ActionMacWindows / Linux
Move line up / downoption(⌥) ↑ / ↓Alt ↑ / ↓
Copy line up / downoption(⌥) shift(⇧) ↑ / ↓Alt Shift ↑ / ↓
Delete linecommand(⌘) shift(⇧) KCtrl Shift K
Insert line belowcommand(⌘) EnterCtrl Enter
Insert line abovecommand(⌘) shift(⇧) EnterCtrl Shift Enter
Toggle line commentcommand(⌘) /Ctrl /
Toggle block commentoption(⌥) shift(⇧) AShift Alt A
Format documentoption(⌥) shift(⇧) FShift Alt F
Format selectioncommand(⌘) K, command(⌘) FCtrl K, Ctrl F
Fold / unfold current blockcommand(⌘) option(⌥) [ / ]Ctrl Shift [ / ]
Fold / unfold allcommand(⌘) K, command(⌘) 0 / command(⌘) K, command(⌘) JCtrl K, Ctrl 0 / Ctrl K, Ctrl J

option(⌥) ↑↓ (move) and option(⌥) shift(⇧) ↑↓ (copy) can be confusing at first. With shift, it copies; without, it moves. It’s worth remembering the difference so you don’t panic when the original line disappears.

Code folding (command(⌘) option(⌥) [/]) is useful when reading long files. Folding blocks you’re not interested in makes the overall structure visible at a glance. An effective approach is to fold everything with command(⌘) K, command(⌘) 0 and then unfold only the parts you need.

Multi-Cursor

One of the most powerful features in VS Code. When you need to edit the same pattern in multiple places simultaneously, instead of replacing them one by one, you can create multiple cursors and edit everything at once.

ActionMacWindows / Linux
Add next occurrence to selectioncommand(⌘) DCtrl D
Select all occurrencescommand(⌘) shift(⇧) LCtrl Shift L
Add cursor above / belowcommand(⌘) option(⌥) ↑ / ↓Ctrl Alt ↑ / ↓
Add cursor at click positionoption(⌥) clickAlt click
Undo last cursor selectioncommand(⌘) UCtrl U
Exit multi-cursorEscEsc

command(⌘) D adds the same word one at a time, letting you precisely select exactly as many as you want. If you need to change all of them, command(⌘) shift(⇧) L grabs everything at once.

If you accidentally place a cursor in the wrong spot while creating multi-cursors, command(⌘) U removes only the last one added. Esc dismisses all multi-cursors, so pressing it by mistake means starting over.

Refactoring & Code Actions

ActionMacWindows / Linux
Rename symbolF2F2
Quick fix / code actioncommand(⌘) .Ctrl .
Trigger autocompletecontrol(⌃) SpaceCtrl Space
Show hover infocommand(⌘) K, command(⌘) ICtrl K, Ctrl I

command(⌘) . serves the same role as IntelliJ’s option(⌥) Enter. On errors, it shows fix suggestions; on valid code, it offers refactoring options. The suggestions depend on installed extensions, so make sure the extension for your language is installed for it to work properly.

ActionMacWindows / Linux
Toggle sidebarcommand(⌘) BCtrl B
Explorercommand(⌘) shift(⇧) ECtrl Shift E
Source Controlcommand(⌘) shift(⇧) GCtrl Shift G
Extensionscommand(⌘) shift(⇧) XCtrl Shift X
Run and Debugcommand(⌘) shift(⇧) DCtrl Shift D
Toggle bottom panelcommand(⌘) JCtrl J
Problems panelcommand(⌘) shift(⇧) MCtrl Shift M
Output panelcommand(⌘) shift(⇧) UCtrl Shift U

The pattern is command(⌘) shift(⇧) + the panel’s initial. Explorer is E, Source Control is G (Git), Extensions is X, Debug is D. Knowing the pattern makes them easy to remember.

Closing the sidebar with command(⌘) B gives the editor more room. Build the habit of closing it when focusing on code and opening it only when you need to browse files — it makes efficient use of screen space.

Terminal

ActionMacWindows / Linux
Toggle terminalcontrol(⌃) `Ctrl `
New terminalcontrol(⌃) shift(⇧) `Ctrl Shift `
Split terminalcommand(⌘) \Ctrl \

control(⌃) ` (backtick) for toggling the terminal is worth memorizing. The workflow of editing code, running a build, checking results, and returning to code stays uninterrupted with just the keyboard.

Run & Debug

ActionMacWindows / Linux
Start / continue debugF5F5
Stop debugshift(⇧) F5Shift F5
Toggle breakpointF9F9
Step OverF10F10
Step IntoF11F11
Step Outshift(⇧) F11Shift F11

VS Code’s debugger is configured via launch.json. Node.js works out of the box without extra configuration, but other languages require extensions. Start debugging with F5, and when it pauses at a breakpoint, use F10 (Step Over) and F11 (Step Into) to walk through the code line by line while inspecting variable values.


VS Code’s shortcut system uses many chord-style shortcuts that begin with command(⌘) K — things like command(⌘) K, command(⌘) S (keyboard shortcuts settings), command(⌘) K, command(⌘) F (format selection), and command(⌘) K, command(⌘) 0 (fold all). They feel awkward at first, but it helps to understand the pattern: “press command(⌘) K, then the next key specifies the action.” When you can’t remember a shortcut, open command(⌘) K, command(⌘) S to search for both the feature and its shortcut.


Related Posts

Share this post on:

Comments

Loading comments...


Previous Post
IntelliJ IDEA: Frequently Used Shortcuts
Next Post
Claude Code: Frequently Used Commands