Visual Studio Code keyboard shortcuts
The essential keyboard shortcuts for Visual Studio Code, from the command palette to multi-cursor editing. Updated July 2026.
General
Multi-cursor
Editing
Refactoring
Navigation
Search
View
They should tell you about this
Workflow tricks Visual Studio Code never mentions — curated from real use.
Undo a cursor move without undoing your edits⌘+U
Cmd+U (Ctrl+U on Windows) is Cursor Undo: it reverts your last cursor movement or selection change without touching the text. Pressed Cmd+D one time too many while multi-selecting? Cursor Undo drops just the last added selection. Jumped to the end of the file and lost your place? It puts the cursor right back where it was.
Skip a match while multi-selecting with Cmd+D⌘+K+⌘+D
When you are selecting occurrences one by one with Cmd+D (Ctrl+D on Windows) and hit a match you do not want to edit, press Cmd+K followed by Cmd+D: the most recent selection is released and the highlight moves on to the next match. This lets you rename most-but-not-all occurrences in one multi-cursor pass instead of falling back to find and replace.
Jump straight to a line from Quick Open⌘+P
In Quick Open (Cmd+P / Ctrl+P), append a colon and a line number to the filename — typing server.ts:120 opens that file with the cursor already on line 120. It is perfect for stack traces: read the frame, type the location, land on the failing line. Appending @ instead filters the file's symbols so you can jump directly to a function by name.
Recover old versions from the built-in Local History
VS Code silently keeps a local history of every file: open the Timeline view at the bottom of the Explorer sidebar and you will see an entry for each save. Click one to diff it against the current file, or use its context menu to restore the old contents. It works with no extensions and no git, so it can rescue changes you never committed — or a file you broke five saves ago.
Grow your selection by syntax scope, not by character⌃+⇧+⌘+→
Ctrl+Shift+Cmd+Right (Shift+Alt+Right on Windows) expands the selection outward through syntactic scopes: word, then string, then expression, then the enclosing block. Press it a few times to select exactly the argument, call, or function you are inside without carefully dragging. The Left arrow variant shrinks the selection back one step at a time.