Skip to content
Back to projects

Motions.

A searchable Vim reference with a practice pad that runs real keybindings.

Context

Motions is a Vim reference you can search in plain English. Typing “delete a word”, “save and quit”, or “go to line 42” returns the keys, and a practice pad next to the catalog runs the real bindings so the answer can be tried instead of memorized.

The catalog holds 283 commands. The pad is built on CodeMirror and codemirror-vim, and covers visual and blockwise modes, registers, macros, marks, text objects, dot-repeat, search, and ex commands.

Constraints

Vim documentation is already complete and already searchable — by name. The gap is the other direction: someone knows what they want to do and does not know what it is called. That is a retrieval problem, not a documentation problem.

Some questions have no key sequence at all. Commenting, multiple cursors, and surround are plugin territory or idiom, and returning the closest-looking keys for them teaches the wrong thing.

A practice pad is also expensive. An editor shipped on every page load would make a reference lookup slower than reading the help file.

Pivotal decisions

Answer the questions Vim cannot

Terms with no single command get a written answer rather than a near match. The catalog is more useful when it can say that something is not a motion than when it guesses.

Load the editor only when it is wanted

The pad is about 130 KB gzipped and is fetched when someone opens it. Searching the catalog stays a text interaction.

Pin the emulation to a table, not to impressions

Accuracy is the whole claim of a practice pad, so the behavior is fixed by a conformance table in app/lib/vim-pad.cases.ts: a document, a key sequence, and the resulting text and cursor position, each checked against Vim 9 by hand.

bun run test runs the table in jsdom. Cases flagged needsLayout are skipped there, because CodeMirror resolves j/k and blockwise selections through real pixel measurement that jsdom cannot produce. A dev-only /__conformance route runs the full table in a browser and also checks that every drill is solvable by its own hint.

Record the deviation instead of hiding it

A linewise delete reaching the last line (dG, 2dd, :2,3d) leaves a trailing blank line where Vim removes it. At the point the change is dispatched it is indistinguishable from a charwise 0d$ on the final line, which legitimately leaves that blank, so the pad has no signal to correct only the first case. It is marked knownDeviation in the table and reported separately rather than dropped from the suite.

Outcomes

Motions is live. It answers a lookup in plain language, says plainly when Vim has no answer, and lets the keys be run in the same session.

The conformance table is the part I would keep if I rebuilt it. It turned “the pad feels right” into a list of rows that either pass or are documented as not passing.