Toolmingo
Guides9 min read

VS Code Cheat Sheet: Shortcuts, Tips & Extensions

Complete VS Code cheat sheet — keyboard shortcuts for Windows, Mac, and Linux, multi-cursor editing, Command Palette, debugging, Git integration, and must-have extensions.

Visual Studio Code is the world's most popular code editor. This cheat sheet covers the keyboard shortcuts, editing tricks, and settings that will make you dramatically faster — whether you're on Windows, Mac, or Linux.

Notation: Ctrl = Windows/Linux · Cmd = macOS · Alt = Windows/Linux · Opt = macOS.

Quick reference

Shortcut (Win/Linux) Shortcut (Mac) What it does
Ctrl+P Cmd+P Quick Open file
Ctrl+Shift+P Cmd+Shift+P Command Palette
Ctrl+`` Ctrl+`` Toggle terminal
Ctrl+B Cmd+B Toggle sidebar
Ctrl+/ Cmd+/ Toggle line comment
Alt+Up/Down Opt+Up/Down Move line up/down
Alt+Shift+Up/Down Opt+Shift+Up/Down Copy line up/down
Ctrl+D Cmd+D Select next occurrence
Ctrl+Shift+L Cmd+Shift+L Select all occurrences
Ctrl+F Cmd+F Find in file
Ctrl+H Cmd+H Find and replace
Ctrl+Shift+F Cmd+Shift+F Find in all files
F2 F2 Rename symbol
F12 F12 Go to definition
Alt+F12 Opt+F12 Peek definition
Shift+F12 Shift+F12 Find all references
Ctrl+G Ctrl+G Go to line
Ctrl+Shift+K Cmd+Shift+K Delete line
Ctrl+Z Cmd+Z Undo
Ctrl+Shift+Z Cmd+Shift+Z Redo
Ctrl+S Cmd+S Save
Ctrl+Shift+S Cmd+Shift+S Save as
Ctrl+W Cmd+W Close tab
Ctrl+Shift+T Cmd+Shift+T Reopen closed tab
Ctrl+Tab Ctrl+Tab Switch between open files

Navigation

File navigation

Ctrl+P / Cmd+P        Quick Open — type filename to jump
Ctrl+R / Cmd+R        Recent files and workspaces
Ctrl+Shift+E          Focus Explorer panel
Ctrl+Shift+G          Focus Source Control panel
Ctrl+Shift+X          Focus Extensions panel
Ctrl+Shift+D          Focus Run and Debug panel

Use @ inside Quick Open to jump to a symbol in the current file:

Ctrl+P then type @     → symbols in current file
Ctrl+P then type @:    → symbols grouped by category
Ctrl+P then type #     → symbols across workspace
Ctrl+P then type :42   → jump to line 42

Cursor and selection

Shortcut (Win/Linux) Shortcut (Mac) What it does
Home / End Home / End Line start / end
Ctrl+Home Cmd+Home File start
Ctrl+End Cmd+End File end
Ctrl+Left/Right Opt+Left/Right Word jump
Ctrl+Shift+Left/Right Opt+Shift+Left/Right Select word
Shift+Alt+Right Shift+Opt+Right Expand selection
Shift+Alt+Left Shift+Opt+Left Shrink selection
Ctrl+L Cmd+L Select entire line
Ctrl+Shift+Up/Down Cmd+Shift+Up/Down Add cursor above/below

Brackets and code folding

Ctrl+Shift+\ / Cmd+Shift+\    Jump to matching bracket
Ctrl+K Ctrl+[                  Fold region
Ctrl+K Ctrl+]                  Unfold region
Ctrl+K Ctrl+0                  Fold all
Ctrl+K Ctrl+J                  Unfold all
Ctrl+K Ctrl+L                  Toggle fold current region

Editing

Line operations

Alt+Up / Opt+Up          Move line up
Alt+Down / Opt+Down      Move line down
Shift+Alt+Up             Copy line above
Shift+Alt+Down           Copy line below
Ctrl+Shift+K             Delete entire line
Ctrl+Enter               Insert line below (stays on current line)
Ctrl+Shift+Enter         Insert line above
Ctrl+]                   Indent line
Ctrl+[                   Outdent line

Multi-cursor editing (very powerful)

Alt+Click / Opt+Click        Place additional cursor
Ctrl+Alt+Up/Down             Add cursor above/below
Ctrl+D / Cmd+D               Select next match of current word
Ctrl+K Ctrl+D                Skip current match, go to next
Ctrl+Shift+L / Cmd+Shift+L  Select ALL matches in file
Alt+Shift+I / Opt+Shift+I   Add cursor to end of each selected line
Esc                          Return to single cursor

Practical example — rename all occurrences inline:

  1. Click on a variable name
  2. Press Ctrl+Shift+L to select all occurrences
  3. Type the new name — all change simultaneously

Code intelligence

Ctrl+Space / Cmd+Space    Trigger autocomplete
Ctrl+Shift+Space          Trigger parameter hints
Shift+Alt+F               Format document
Ctrl+K Ctrl+F             Format selection
F8                        Go to next error/warning
Shift+F8                  Go to previous error/warning
Ctrl+.                    Quick fix / code actions

Search and replace

In current file

Ctrl+F / Cmd+F            Find
Ctrl+H / Cmd+H            Find and replace
Enter / Shift+Enter        Next / previous match
Alt+Enter                  Select all matches
Ctrl+Alt+Enter             Replace all

Toggle options in the search bar:

  • Alt+C — case sensitive
  • Alt+W — whole word
  • Alt+R — use regex

Across workspace

Ctrl+Shift+F / Cmd+Shift+F    Find in all files
Ctrl+Shift+H / Cmd+Shift+H    Replace in all files

Use files to include and files to exclude boxes to narrow scope:

src/**/*.ts        search only TypeScript files in src/
!node_modules/**   exclude node_modules

Terminal

Ctrl+`                Open/close integrated terminal
Ctrl+Shift+`          Open new terminal instance
Ctrl+Shift+5          Split terminal
Ctrl+PageUp/Down      Switch between terminals
Ctrl+C                Kill current command
Alt+Up/Down           Scroll terminal output

Run the current file:

Ctrl+F5               Run without debugging
F5                    Run with debugging

Git integration

VS Code has built-in Git support. Open Source Control with Ctrl+Shift+G.

Ctrl+Shift+G          Open Source Control panel
Ctrl+Enter            Commit staged changes (in message box)

Useful Git actions via Command Palette (Ctrl+Shift+P):

Git: Clone                  Clone a repository
Git: Stage All Changes      Stage everything
Git: Unstage All Changes    Unstage everything
Git: Checkout to...         Switch branch
Git: Create Branch...       New branch
Git: Merge Branch...        Merge into current
Git: Fetch                  Fetch from remote
Git: Pull                   Pull from remote
Git: Push                   Push to remote
Git: Show History           Open Git log

Inline diff view: Click any changed file in Source Control to see a side-by-side diff. Click the gutter line numbers to stage individual lines (hunk staging).


Debugging

F5                    Start / continue debugging
Shift+F5              Stop debugging
Ctrl+Shift+F5         Restart debugging
F9                    Toggle breakpoint
F10                   Step over
F11                   Step into
Shift+F11             Step out
Ctrl+K Ctrl+I         Show hover value (while debugging)

launch.json quick setup: Open Command Palette → Debug: Add Configuration to generate a launch.json for your language.

Minimal Node.js example:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceFolder}/src/index.js",
      "skipFiles": ["<node_internals>/**"]
    }
  ]
}

Conditional breakpoints: Right-click a breakpoint dot → Edit Breakpoint → add a condition like count > 10 — the debugger only pauses when true.


Workspace and settings

Split editors

Ctrl+\                    Split editor right
Ctrl+K Ctrl+\             Split editor down
Ctrl+1 / 2 / 3           Focus editor group 1/2/3
Ctrl+K Left/Right         Move editor between groups

Zen mode and full screen

Ctrl+K Z              Toggle Zen mode (minimal UI)
F11                   Toggle full screen
Ctrl+B                Toggle sidebar
Ctrl+J                Toggle bottom panel

Settings

Ctrl+, / Cmd+,        Open Settings UI
Ctrl+Shift+P then
  "Open User Settings (JSON)"   → settings.json
  "Open Workspace Settings"     → project-level overrides

Useful settings to add to settings.json:

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.tabSize": 2,
  "editor.wordWrap": "on",
  "editor.minimap.enabled": false,
  "editor.linkedEditing": true,
  "editor.suggestSelection": "first",
  "files.trimTrailingWhitespace": true,
  "files.insertFinalNewline": true,
  "terminal.integrated.fontSize": 13,
  "workbench.colorTheme": "One Dark Pro",
  "explorer.confirmDelete": false,
  "breadcrumbs.enabled": true
}

Snippets

Use built-in snippets: Type a trigger word and press Tab.

Common TypeScript/React triggers:

Trigger Snippet
! HTML boilerplate
rafce React arrow function component (ES7 extension)
useState useState hook
useEffect useEffect hook
clg console.log()
imp import ... from '...'
trycatch try/catch block

Create custom snippets: Command Palette → Snippets: Configure User Snippets → pick a language.

// .vscode/snippets/typescript.json
{
  "Console log variable": {
    "prefix": "cl",
    "body": "console.log('$1:', $1);",
    "description": "Log variable with label"
  },
  "Arrow function": {
    "prefix": "af",
    "body": "const ${1:name} = (${2:params}) => {\n\t$0\n};",
    "description": "Arrow function"
  }
}

Must-have extensions

Extension What it does
Prettier (esbenp.prettier-vscode) Auto-format on save
ESLint (dbaeumer.vscode-eslint) JavaScript/TypeScript linting
GitLens (eamodio.gitlens) Advanced Git blame, history
Error Lens (usernamehw.errorlens) Inline error messages
Path Intellisense (christian-kohler.path-intellisense) Autocomplete file paths
Auto Rename Tag (formulahendry.auto-rename-tag) Sync HTML open/close tags
Bracket Pair Colorizer (built-in) Color-matched brackets
Thunder Client (rangav.vscode-thunder-client) REST client inside VS Code
REST Client (humao.rest-client) Send HTTP requests from .http files
Remote - SSH (ms-vscode-remote.remote-ssh) Edit files on a remote server
Docker (ms-azuretools.vscode-docker) Docker file support
GitHub Copilot (github.copilot) AI code completion
Tailwind CSS IntelliSense (bradlc.vscode-tailwindcss) Tailwind class autocomplete
Prisma (prisma.prisma) Prisma schema formatting
One Dark Pro (zhuangtongfa.material-theme) Popular dark theme

Command Palette tips

Ctrl+Shift+P (or Cmd+Shift+P) is the most powerful shortcut in VS Code. Use it for anything:

> Format Document                 Format current file
> Sort Lines Ascending            Sort selected lines
> Transform to Uppercase          Change case of selection
> Wrap with Abbreviation          Wrap HTML with Emmet
> Change Language Mode            Set file syntax highlighting
> Open Folder as Workspace        Open a folder
> Reload Window                   Restart VS Code window
> Developer: Reload Window        Same as above
> Preferences: Color Theme        Change theme
> Toggle Word Wrap                Enable/disable word wrap
> Copy Path                       Copy file absolute path
> Reveal in File Explorer         Show file in OS explorer

Common mistakes

Mistake Fix
Accidentally deleted a file Check Timeline panel (clock icon in Explorer) → File History
Extensions conflict (e.g., two formatters) Set "editor.defaultFormatter" in settings.json
Settings not applying Workspace settings override user settings — check .vscode/settings.json
Autosave overwriting a bad state Use Ctrl+Z — undo history persists even after save
Terminal using wrong shell Command Palette → Terminal: Select Default Profile
Can't format file Install the right extension (e.g., Prettier) and set it as editor.defaultFormatter
IntelliSense not working Open correct workspace folder; check for tsconfig.json or jsconfig.json

FAQ

Q: How do I open a project folder properly?
Use File → Open Folder (not File → Open File). VS Code's IntelliSense, linting, and Git integration only work correctly when the workspace root is the project folder.

Q: How do I sync VS Code settings across machines?
Turn on Settings Sync: Command Palette → Settings Sync: Turn On. Signs in with GitHub or Microsoft account and syncs settings, keybindings, extensions, and snippets.

Q: How do I use multiple projects at once?
Use a Workspace file (.code-workspace): File → Add Folder to Workspace, then File → Save Workspace As. Open the .code-workspace file to restore all folders at once.

Q: What's the difference between Ctrl+D and Ctrl+Shift+L?
Ctrl+D selects the next matching occurrence one at a time (great for selective editing). Ctrl+Shift+L selects ALL occurrences at once. Use Ctrl+K Ctrl+D to skip an occurrence while using Ctrl+D.

Q: How do I run a task (build, test) from VS Code?
Use tasks.json: Command Palette → Tasks: Configure Task → pick a template. Then run with Ctrl+Shift+B (default build task) or Tasks: Run Task from the palette.

Q: Can VS Code edit remote files?
Yes — install Remote - SSH extension, connect to a server, and VS Code behaves as if the files are local. Works with any SSH server. Also supports WSL (Remote - WSL) and Dev Containers (Dev Containers).

Related tools

Keep reading

All Toolmingotools are free & run in your browser

No sign-up, no upload, no watermark. Your files never leave your device.

Browse all tools