Learn Vim / Collect the set — vim

Collect the set — vim

The answerCanonical keystrokes: "ayy 2j "Ayy G "ap.

Try it on a real buffer

Gather both list items into register a. Yank the first with "ayy, drop to the second (2j) and APPEND it with "Ayy (capital A appends), then paste both under the header (G then "ap).

- milk
noise line
- eggs
noise line
grocery list:

Canonical solution: "ayy 2j "Ayy G "ap · target: 14 keystrokes — the fewest that solve it (every keypress counts).

Why it works

A capital register letter appends instead of overwriting: "ayy then "Ayy leaves both lines stacked in register a. Perfect for collecting scattered lines before pasting them together.

▶ live vim buffertarget 14 keystrokes
Gather both list items into register a. Yank the first with "ayy, drop to the second (2j) and APPEND it with "Ayy (capital A appends), then paste both under the header (G then "ap).

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Collect the set” mission takes about a minute.

Sign in free to practice →

Keep going