VS Code Shortcuts and Settings Cheat Sheet (The 20 That Save Hours)
β‘ Quick Answer
A VS Code shortcuts cheat sheet with Windows and macOS keys β command palette, multi-cursor, navigation, refactoring, debugging, and the settings worth changing.
Get more content like this on Telegram!
Daily AI tips, notes & resources β free
Advertisement
VS Code Shortcuts and Settings Cheat Sheet
Visual Studio Code ships with hundreds of keybindings. Roughly twenty of them account for nearly all the time you can save.
This sheet lists those twenty first, then the settings worth changing on a fresh install. Every table gives Windows/Linux and macOS keys side by side.
Updated for 2026. Covers VS Code 1.9x, all shortcuts at default bindings.
The Command Palette
| Action | Windows / Linux | macOS |
|---|---|---|
| Command palette | Ctrl+Shift+P | Cmd+Shift+P |
| Go to file | Ctrl+P | Cmd+P |
| Open settings (UI) | Ctrl+, | Cmd+, |
| Keyboard shortcuts reference | Ctrl+K Ctrl+S | Cmd+K Cmd+S |
Learn this one first. The palette exposes every command in the editor and every installed extension, fuzzy-searchable, and it displays the keyboard shortcut beside each command.
That last detail makes it a teaching tool. You discover shortcuts while using the thing they trigger, which is the only way they actually stick.
What people get wrong: treating the palette as a fallback for rare commands. It is faster than the menu bar for almost everything, including ones you use daily.
Navigation
| Action | Windows / Linux | macOS |
|---|---|---|
| Go to file (fuzzy) | Ctrl+P | Cmd+P |
| Go to symbol in file | Ctrl+Shift+O | Cmd+Shift+O |
| Go to symbol in workspace | Ctrl+T | Cmd+T |
| Go to line | Ctrl+G | Ctrl+G |
| Go to definition | F12 | F12 |
| Peek definition (inline) | Alt+F12 | Opt+F12 |
| Find all references | Shift+F12 | Shift+F12 |
| Go back / forward | Alt+β / Alt+β | Ctrl+- / Ctrl+Shift+- |
| Switch between open files | Ctrl+Tab | Ctrl+Tab |
Ctrl+P accepts prefixes, and this is the part most people never learn:
Ctrl+P then @symbolName β jump to a symbol in the current file
Ctrl+P then #symbolName β search symbols across the workspace
Ctrl+P then :42 β jump to line 42
Ctrl+P then file.ts:42 β open a file directly at line 42
Ctrl+P then > β becomes the command paletteOne keystroke opens a prompt that does five different jobs depending on the first character you type. Ctrl+P then @ replaces scrolling for a symbol in a 900-line file.
Alt+β (go back) is the underrated one. After chasing a definition three files deep, it walks you back along exactly the path you came.
Multi-Cursor Editing
| Action | Windows / Linux | macOS |
|---|---|---|
| Add cursor at click | Alt+Click | Opt+Click |
| Add cursor above / below | Ctrl+Alt+β / β | Cmd+Opt+β / β |
| Select next occurrence | Ctrl+D | Cmd+D |
| Skip current, select next | Ctrl+K Ctrl+D | Cmd+K Cmd+D |
| Select all occurrences | Ctrl+Shift+L | Cmd+Shift+L |
| Column (box) selection | Shift+Alt+drag | Shift+Opt+drag |
| Back to one cursor | Esc | Esc |
Four methods, four different jobs:
| Method | Best for |
|---|---|
Alt+Click | Scattered, unrelated positions |
Ctrl+Alt+β/β | Aligned columns β a block of imports, a table |
Ctrl+D repeatedly | Renaming within a limited, visible scope |
Ctrl+Shift+L | Every occurrence in the file at once |
What people get wrong: hammering Ctrl+D past an occurrence they did not want and starting over. Ctrl+K Ctrl+D skips the current match and moves to the next one, keeping everything already selected.
Selection and Line Editing
| Action | Windows / Linux | macOS |
|---|---|---|
| Expand selection | Shift+Alt+β | Ctrl+Shift+β |
| Shrink selection | Shift+Alt+β | Ctrl+Shift+β |
| Move line up / down | Alt+β / Alt+β | Opt+β / Opt+β |
| Copy line up / down | Shift+Alt+β / β | Shift+Opt+β / β |
| Delete line | Ctrl+Shift+K | Cmd+Shift+K |
| Insert line below / above | Ctrl+Enter / Ctrl+Shift+Enter | Cmd+Enter / Cmd+Shift+Enter |
| Toggle line comment | Ctrl+/ | Cmd+/ |
| Toggle block comment | Shift+Alt+A | Shift+Opt+A |
| Indent / outdent | Ctrl+] / Ctrl+[ | Cmd+] / Cmd+[ |
| Format document | Shift+Alt+F | Shift+Opt+F |
| Fold / unfold region | Ctrl+Shift+[ / ] | Cmd+Opt+[ / ] |
Expand selection is the most underused shortcut in the editor. Press it once from inside a string and you select the string; again and you have the argument list; again the whole call; again the statement; again the enclosing block. It is syntax-aware, so it always selects a structurally valid region.
That means you never need to drag-select a function again β and shrink selection walks it back if you overshoot.
Alt+β/Alt+β moves a line without cut and paste, and it re-indents automatically as it crosses block boundaries.
Refactoring
| Action | Windows / Linux | macOS |
|---|---|---|
| Rename symbol | F2 | F2 |
| Quick fix / refactor menu | Ctrl+. | Cmd+. |
| Trigger suggestions | Ctrl+Space | Ctrl+Space |
| Parameter hints | Ctrl+Shift+Space | Cmd+Shift+Space |
| Organise imports | Shift+Alt+O | Shift+Opt+O |
Why F2 beats find-and-replace
F2 is language-aware. It asks the language server which references belong to this specific symbol, then updates all of them across the whole project β including imports, exports, and re-exports β and shows a preview first.
Find-and-replace is a text operation. It has no idea what a scope is, so it will happily rewrite:
- the same word inside a string literal
- the same word in a comment
- an unrelated local variable in another function
- a property on a completely different object
// F2 on `count` renames ONLY this variable and its references
const count = items.length;
// It leaves this alone:
const message = "count of items"; // string literal
user.count = 5; // different symbol entirelyThe distinction only matters when it goes wrong, which is why so many developers learn it the expensive way. If a rename is not purely mechanical, F2 is not optional. The TypeScript cheat sheet covers the language-server features that make this work.
Ctrl+. opens the quick-fix menu on any squiggle: import the missing module, extract to a function, convert to arrow syntax, add a missing property. It is where most of the editor's refactoring lives.
Search and Replace
| Action | Windows / Linux | macOS |
|---|---|---|
| Find in file | Ctrl+F | Cmd+F |
| Replace in file | Ctrl+H | Cmd+Opt+F |
| Find in all files | Ctrl+Shift+F | Cmd+Shift+F |
| Replace in all files | Ctrl+Shift+H | Cmd+Shift+H |
| Toggle regex mode | Alt+R | Cmd+Opt+R |
| Toggle match case | Alt+C | Cmd+Opt+C |
| Toggle whole word | Alt+W | Cmd+Opt+W |
| Next / previous match | Enter / Shift+Enter | Enter / Shift+Enter |
With regex mode on, the replace field supports capture group references:
Find: const (\w+) = require\('(.+)'\)
Replace: import $1 from '$2'That converts CommonJS requires to ES module imports across a whole project. $1 and $2 insert whatever the parenthesised groups captured. The regex cheat sheet covers the pattern syntax in full.
The files to include and files to exclude boxes take glob patterns β src/**/*.ts, !**/dist/** β which is how you keep a search out of build output and node_modules.
Terminal and Panels
| Action | Windows / Linux | macOS |
|---|---|---|
| Toggle terminal | Ctrl+` | Ctrl+` |
| New terminal | Ctrl+Shift+` | Ctrl+Shift+` |
| Toggle sidebar | Ctrl+B | Cmd+B |
| Toggle panel | Ctrl+J | Cmd+J |
| Focus explorer | Ctrl+Shift+E | Cmd+Shift+E |
| Focus source control | Ctrl+Shift+G | Ctrl+Shift+G |
| Focus problems | Ctrl+Shift+M | Cmd+Shift+M |
| Zen mode | Ctrl+K Z | Cmd+K Z |
The backtick toggle is the highest-frequency shortcut on this page for most developers. Opening a terminal already rooted in the project directory removes the context switch to a separate application entirely β pair it with the Git commands cheat sheet and most version-control work never leaves the editor.
Split Editors
| Action | Windows / Linux | macOS |
|---|---|---|
| Split editor | Ctrl+\ | Cmd+\ |
| Focus group 1 / 2 / 3 | Ctrl+1 / 2 / 3 | Cmd+1 / 2 / 3 |
| Move editor to next group | Ctrl+Alt+β | Cmd+Ctrl+β |
| Close editor | Ctrl+W | Cmd+W |
| Reopen closed editor | Ctrl+Shift+T | Cmd+Shift+T |
| Toggle editor layout | Shift+Alt+0 | Shift+Opt+0 |
Ctrl+Shift+T reopens the file you just closed by accident, and it works repeatedly going backwards through your close history.
Shift+Alt+0 flips a split between vertical and horizontal, which matters more than it sounds on a laptop screen where side-by-side is too narrow to read.
Debugging
| Action | Windows / Linux | macOS |
|---|---|---|
| Start / continue | F5 | F5 |
| Start without debugging | Ctrl+F5 | Ctrl+F5 |
| Stop | Shift+F5 | Shift+F5 |
| Restart | Ctrl+Shift+F5 | Cmd+Shift+F5 |
| Step over | F10 | F10 |
| Step into | F11 | F11 |
| Step out | Shift+F11 | Shift+F11 |
| Toggle breakpoint | F9 | F9 |
| Conditional breakpoint | right-click the gutter | right-click the gutter |
Conditional breakpoints are the feature worth adopting. Right-click the gutter and enter an expression such as user.id === 4218, and execution pauses only when it is true.
This replaces the habit of adding a console.log inside an if, running, reading, editing, and re-running. A loop of ten thousand iterations stops on the one that matters, with the full call stack and every variable in scope available.
Logpoints are the same menu's other option: a breakpoint that prints a message instead of pausing. It gives you logging without editing the source file, which means no accidental debug statement in a commit.
Settings Worth Changing
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.organizeImports": "explicit" },
"files.autoSave": "onFocusChange",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"editor.stickyScroll.enabled": true,
"editor.linkedEditing": true,
"editor.minimap.enabled": false,
"explorer.compactFolders": false,
"workbench.editor.enablePreview": false
}What each one buys you:
formatOnSaveβ you stop thinking about formatting, and diffs stop containing whitespace noise.organizeImportson save β dead imports are removed automatically, so the linter stops complaining.autoSave: onFocusChangeβ saves when you leave the window. Safer thanafterDelay, which can trigger a rebuild mid-keystroke.stickyScrollβ pins the enclosing function and class headers at the top of the viewport. In a long file this is the difference between knowing and guessing where you are.linkedEditingβ editing an HTML or JSX opening tag updates the closing tag as you type.enablePreview: falseβ stops single-click file opens from replacing each other in the same italic tab. Every file you open stays open.compactFolders: falseβ the explorer stops collapsingsrc/components/uiinto one line, which makes it clickable at each level.
What people get wrong: installing a formatter extension and never enabling formatOnSave, then formatting manually with Shift+Alt+F and forgetting half the time. The result is a repository where formatting changes are scattered through unrelated commits.
Settings Sync
Built in β no extension needed. Click the account icon at the bottom of the activity bar, sign in with GitHub or a Microsoft account, and choose what to sync:
| Category | Syncs |
|---|---|
| Settings | settings.json |
| Keyboard shortcuts | Per-platform where they differ |
| Extensions | Installed list, including disabled state |
| User snippets | Custom snippet files |
| UI state | Layout, open panels |
| Profiles | Whole named configurations |
A new machine goes from blank to fully configured in about two minutes. Keybindings are stored per platform, so a Windows desktop and a Mac laptop share one profile without overwriting each other.
The Five Mistakes
1. Using find-and-replace to rename a symbol. F2 understands scope; text matching does not. It will rewrite strings, comments, and unrelated variables.
2. Never learning Ctrl+P prefixes. @, #, : and > turn one shortcut into five tools. Most people use only the file search.
3. Debugging with console.log instead of conditional breakpoints. Edit, run, read, edit again β versus stopping exactly once on iteration 4,218 with the whole stack visible.
4. Installing a formatter without formatOnSave. Manual formatting is inconsistent formatting, and it pollutes every diff.
5. Ignoring Settings Sync. Every reinstall or new laptop costs an afternoon of reconfiguration that a two-minute sign-in would have eliminated.
Print This Section
PALETTE Ctrl/Cmd+Shift+P everything, searchable, shows keybindings
FILES Ctrl/Cmd+P then @symbol #workspace :line >command
CURSORS Alt/Opt+Click arbitrary position
Ctrl/Cmd+Alt+ββ aligned column
Ctrl/Cmd+D next occurrence (Ctrl+K Ctrl+D = skip)
Ctrl/Cmd+Shift+L all occurrences
Esc back to one
SELECT Shift+Alt+β expand selection (syntax aware)
Alt/Opt+ββ move line Ctrl/Cmd+Shift+K delete line
Ctrl/Cmd+/ toggle comment
REFACTOR F2 rename symbol β NEVER find-and-replace
Ctrl/Cmd+. quick fix / extract / import
SEARCH Ctrl/Cmd+Shift+F all files Alt+R = regex, $1 in replace
PANELS Ctrl+` terminal Ctrl/Cmd+B sidebar Ctrl/Cmd+J panel
Ctrl/Cmd+\ split Ctrl/Cmd+Shift+T reopen closed file
DEBUG F5 run F9 breakpoint F10 over F11 into Shift+F11 out
right-click gutter β conditional breakpoint / logpoint
SETTINGS formatOnSave Β· autoSave onFocusChange Β· stickyScroll
enablePreview false Β· organizeImports on savePick three shortcuts from this page and use only those for a week. Trying to adopt twenty at once means adopting none β the ones that stick are the ones you were forced to repeat.
π Next in this collection: JavaScript Cheat Sheet, or return to The Complete Developer Cheat Sheet Collection.
Advertisement
π¬ DiscussionPowered by GitHub Discussions
Frequently Asked Questions

AI & Software Engineering Editorial Team
The AiTechWorlds editorial team writes and reviews in-depth guides on artificial intelligence, machine learning, prompt engineering, programming, and developer tools. Every article is fact-checked against primary sources and kept up to date for working developers and CS students.
Not sure yet? Ask AI about this article
Get an instant, unbiased AI summary of βVS Code Shortcuts and Settings Cheat Sheet (The 20 That Save Hours)β.
Advertisement
Related Articles
Bash Scripting Cheat Sheet (The First Line Every Script Needs)
A practical Bash scripting cheat sheet β variables, conditionals, loops, functions, and the set -euo pipefail line that turns silent failure into loud failure.
15 Coding Interview Patterns That Solve Most Problems
The 15 coding interview patterns that cover most problems β the signal that identifies each one, a minimal code skeleton, and a two-minute recognition table.
CSS and Tailwind Cheat Sheet: Flexbox, Grid and Centering Solved
A practical CSS and Tailwind cheat sheet β Flexbox vs Grid decision rules, every centering method, responsive breakpoints, and the specificity traps.
Data Structures and Big-O Cheat Sheet for Coding Interviews
A practical big O cheat sheet β the complexity ladder with real examples, data structure operation tables, and how to state your complexity in an interview.