Selecting every occurrence at once
To grab every occurrence at once, press ⇧⌘L (Ctrl+Shift+L). A cursor lands on every instance of the selected string in the file. Since the blast radius is wide, it's worth scanning the file afterwards to make sure you didn't change something you didn't intend to.
Column (box) selection
For text aligned vertically like a table, use column selection. With the mouse, hold Shift+Alt and drag; with the keyboard, combine the selection shortcuts (Shift + arrow keys) to grab a vertical block. You can then type into the same column of every line at once.
For example, with several similar lines like the ones below, putting a cursor on each line lets you prepend a declaration keyword or append a trailing semicolon in one go.
name = "kim"
email = "kim@example.com"
role = "admin"
// Add a cursor at the start of each line and type 'const ' once
// Add a cursor at the end of each line and append ';' once
Command Palette — run things without digging through menus
Nearly every VS Code feature is registered as a command, and the Command Palette runs any of them by name. Open it with ⇧⌘P (Ctrl+Shift+P). No need to memorize the menu structure — typing a fragment like "format", "rename", or "git" narrows the candidates instantly.
The same input box switches modes depending on its prefix. Knowing this lets one box handle several kinds of navigation.
-
⌘P (Ctrl+P) — jump to a file by name. The companion box to the Command Palette (⇧⌘P).
-
⇧⌘O (Ctrl+Shift+O) — jump to a symbol (function·class, etc.) in the current file. This is the
@ prefix mode of the same input box.
-
⌃G (Ctrl+G) — go to a specific line number.
-
? — type a question mark in the box to see a list of every command mode available right there.
The most common pattern: open ⇧⌘P, type part of a command name, hit Enter. For example, instead of hunting through menus for Format Document, typing just "format" in the palette brings it right up.
Folding and formatting — shortcuts for long files
When a file gets long, folding some blocks away makes it easier to read. Fold all with ⌘K ⌘0 (Ctrl+K Ctrl+0), unfold all with ⌘K ⌘J (Ctrl+K Ctrl+J), and toggle just the block at the cursor with ⌘K ⌘L (Ctrl+K Ctrl+L). These are two-step chords: press ⌘K, then the next key.
Code formatting is done with Format Document. The shortcut is ⇧⌥F (Shift+Alt+F on Windows, Ctrl+Shift+I on Linux), and it reformats the entire current file using the registered formatter's rules. One caveat: a formatter (extension) for that language has to be installed for it to work.
settings.json — configure once, save time every day
There are two ways into settings. The searchable UI opens with ⌘, (Ctrl+,); to edit the JSON file directly, run "Preferences: Open User Settings (JSON)" from the Command Palette. Anything you toggle in the UI ends up in the same JSON anyway, so keeping your go-to settings in JSON makes them easy to carry to a fresh machine.
Below are settings shown as examples in the official docs: format on save, auto-save after a delay, visible whitespace characters, and soft-wrapping long lines.
//settings.json(User){"editor.formatOnSave":true,"files.autoSave":"afterDelay","editor.renderWhitespace":"all","editor.wordWrap":"on"}
formatOnSave runs the formatter on every save to keep things tidy (again, a formatter must be installed). Setting autoSave to "afterDelay" saves your file automatically after a moment, no ⌘S required. renderWhitespace makes spaces and tabs visible, which helps catch mixed indentation.
Good to know upfront
Common gotchas when using these settings and shortcuts:
- The shortcuts above are defaults. They can stop working if another extension or an OS shortcut conflicts — when that happens, run "Open Keyboard Shortcuts" from the Command Palette to check for collisions.
- Format Document and formatOnSave only work with a formatter extension installed. Default formatters vary by language, so if formatting does nothing, check whether a formatter for that language is installed first.
- Select-all shortcuts like ⇧⌘L cast a wide net and can change the same string in places you didn't intend. After a broad selection, review before applying.
- With autoSave on, saves happen automatically — anything wired to save events (format·lint) may run more often than you expect.
What order to learn them in
Trying to memorize everything at once means nothing sticks. Start with the two highest-frequency ones — ⌘D (select same word) and ⇧⌘P (Command Palette) — for a few days, and once they're in muscle memory, add cursor-above/below and settings.json. Whenever you catch yourself doing something with the mouse, ask "is there a shortcut for this?" and search the Command Palette — the shortcuts for your most-used commands will start sticking on their own.
Getting started: Install from the official site, and open the full shortcut list via "Open Keyboard Shortcuts" in the Command Palette — it's searchable. It also shows exactly how each shortcut above is bound on your own keyboard layout.
Sources
This is an objective guide compiled from the official VS Code documentation, not a personal usage review. Shortcuts are macOS defaults and may differ by version, OS, and extension setup.
Originally published at jessinvestment.com
Original with full infographics and visual structure: https://jessinvestment.com/vs-code-shortcuts-and-settings-that-cut-your-mouse-usage/