How do I cycle through the numbered delete registers using the dot command?
Answer
"1p and .
Explanation
When you paste from a numbered register with "1p, Vim's dot command (.) automatically advances to the next numbered register on each repeat. This means "1p.. pastes from registers 1, 2, and 3 in sequence — without specifying each register manually. This behavior, described in :help redo-register, is designed for recovering and reusing a series of recent deletions.
How it works
"1p— paste the contents of numbered register 1 (the most recent deletion).— repeat the put command, but Vim automatically uses register"2instead of"1.again — uses"3, and so on up through"9
Vim maintains a delete history in registers "1 through "9. Each new deletion larger than one character shifts older deletions down: "1 gets the latest, "2 the one before it, etc.
Example
You deleted three lines at different points in your editing session. Now you want to paste them all back:
Line from register 1 (most recent delete)
Line from register 2
Line from register 3
Using "1p.. pastes all three in sequence.
To cycle through and find the right deletion (rather than paste all), use the undo-based pattern:
"1pu.u.u.
Each u. undoes the wrong paste and retries with the next register.
Tips
- Only deletions of one character or more are stored;
xanddlon a single character go to the small-delete register"- - Use
:regto inspect all numbered register contents before pasting "0ppastes the most recent yank (unaffected by deletions)