Learn Vim / The yank that lived — vim

The yank that lived — vim

The answerCanonical keystrokes: yy j dd "0p.

Try it on a real buffer

Copy the GOLD line with yy. Then delete the junk line (j dd) — that overwrites the unnamed register. Paste your original copy under the list with "0p (plain p would paste the junk).

GOLD
junk line, delete me
treasure list:

Canonical solution: yy j dd "0p · par: 8 keystrokes (vimgolf rules — every keypress counts).

Why it works

Every yank also lands in register 0, which deletes never touch. So after a yank-then-delete, "0p still pastes what you yanked — the fix for vim's most common “my copy just vanished!” moment.

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

Practice free — no signup →

Keep going