NoobProMax

Working together

The keyboard shortcuts actually worth learning

Learning shortcuts alphabetically is why most people give up. Learn them by the problem they remove.

8 min read

Every editor ships with a few hundred keyboard shortcuts, and the standard advice is to print the cheat sheet. Nobody has ever learned a keyboard shortcut from a printed cheat sheet, because a list sorted by key tells you what a chord does and never tells you why you would want it.

There are roughly a dozen that change how fast you work. What they have in common is that each removes a repetitive manual operation you are currently doing without noticing. Learn them by the annoyance they delete.

Below, Mod means on macOS and Ctrl elsewhere. These are the CodeMirror bindings, which are close to the VS Code set; most transfer directly.

The one to learn first

Mod-P — the command palette

Every other shortcut is optional if you have this one. The palette is a searchable list of every action the editor can perform, so instead of memorising a chord you type three letters of what you want.

Its real value is discovery. Open it and read the list — you will find four or five things you did not know existed, and each one shows its own shortcut next to it, so the palette teaches you the chords for the commands you actually use. That is the mechanism by which people learn shortcuts: repeated exposure to the ones relevant to them, not memorisation of a table.

The corollary is that you should stop reaching for menus entirely. A week of forcing every action through the palette teaches you more than any reference will.

Multiple cursors, which is the big one

If you learn exactly one editing technique from this page, this is it. It is the difference between a repetitive edit taking two minutes and taking four seconds, and it comes up several times a day.

Mod-D — select next occurrence

Put the cursor on a word, press it: the word is selected. Press again: the next occurrence gets its own cursor, with the word selected. Keep going, then type — you are editing all of them at once.

This is the correct tool for renaming a local variable, changing every let to const in a block, or adding a prefix to six adjacent properties. It beats find-and-replace for these because you can see and control exactly which occurrences you took, and stop when you reach one you did not want.

Mod-Shift-L — select all occurrences

The same thing, everywhere in the file, at once. Faster when you are certain, riskier when you are not.

Alt-click — a cursor wherever you click

The escape hatch for cases with no textual pattern: place cursors at arbitrary points and type into all of them. Also Alt-drag to place a cursor on every line of a block, which is how you comment out or indent an irregular region.

The mental shift worth making is to notice the feeling of doing the same edit twice. That feeling is the cue. Once you start catching it, you use multiple cursors constantly.

Line manipulation

Individually trivial, collectively responsible for a surprising fraction of the mouse work in a normal editing session.

ShortcutWhat it doesReplaces
Alt-↑ / Alt-↓Move the current line up or downCut, click, paste, fix the blank line
Shift-Alt-↑ / ↓Duplicate the line above or belowSelect, copy, newline, paste
Mod-Shift-KDelete the whole lineHome, Shift-End, Delete, Backspace
Mod-/Toggle comment on the line or selectionTyping // repeatedly

No selection is required for any of these — they operate on the line the cursor is in, which is what makes them fast. Combined with multiple cursors they apply to every selected line at once, so Mod-/ with six cursors comments out six scattered lines together.

Moving without the mouse

The mouse is not slow because of the hand movement. It is slow because it requires you to visually locate a target, which interrupts what you were thinking about.

  • Mod-← / Mod-→ — start and end of line. Home and End also work, and Mod-← is usually smart about jumping to the first non-whitespace character rather than column zero.
  • Alt-← / Alt-→ — one word at a time. Add Shift to select as you go, which is how you select an argument list without touching the mouse.
  • Mod-↑ / Mod-↓ — top and bottom of the document.

These compose. Shift-Alt-→ repeatedly extends a selection word by word; Mod-Shift-← selects to the start of the line. The composability is the point — a dozen keys generate most of the movements you need.

Search, which is also navigation

Mod-F opens find and replace. Two habits make it much more useful than it first appears.

Use it to move, not just to find. Searching for a distinctive substring is usually the fastest way to get the cursor to a specific place, faster than scrolling and faster than a line number.

Learn the regular expression toggle. Not full regex fluency — three constructs cover almost everything you will want. Capture groups (...) with $1 in the replacement handle reordering; \d+ matches any number; .* matches the rest of a line. That is enough to convert a list of values into a list of function calls in one operation.

For anything you can see on screen, though, prefer Mod-D. Find-and-replace is for changes you cannot visually verify; multiple cursors are for the ones you can.

Undo, precisely

Mod-Z undoes and Mod-Shift-Z redoes, which everyone knows. Two refinements that fewer people know.

Mod-U undoes the last selection change rather than the last document change — the fix for having pressed Mod-D one time too many and taken an occurrence you did not want. It steps the selection back without touching your text.

And in a shared document, undo means something more specific than it does alone: it reverses your last change, not the most recent change by anyone. This is a deliberate design decision and the reasoning behind it is worth understanding, because it also explains why undo cannot reach back past the current session and what to use instead when you need to.

Folding, for large files

Mod-Alt-[ and Mod-Alt-] collapse and expand the block at the cursor. Marginal in a hundred-line file and genuinely useful in a thousand-line one, where folding everything except the two functions you care about turns an unreadable file into a readable one.

Folding works because the editor has a parse tree rather than a list of lines — the same structure that produces syntax highlighting also knows where each block begins and ends.

How to actually learn them

Not all at once. The failure mode is trying to adopt twenty shortcuts on a Monday and using none of them by Wednesday, because under deadline pressure everyone reverts to what is automatic.

One per week. Pick a single shortcut and use it deliberately, including when reaching for the mouse would be faster today. It takes a few days to become automatic and then it is free forever.

Pick it from your own annoyance. Notice what you repeat. If you frequently move lines around, learn Alt-↑. If you rename variables constantly, learn Mod-D. A shortcut adopted because it solves something you personally do sticks; one adopted from a list does not.

Use the palette in between. Mod-P covers everything you have not learned yet, and shows you the chord each time — so the learning happens on its own, in the order that matters to you.

If you only take three

Mod-P for everything you have not memorised, Mod-D for repetitive edits, and Alt-↑/↓ for moving lines. These three cover most of the daily friction; the rest is refinement.