Numbered Registers

"0 = last yank. "1โ€“"9 = the last nine deletes.

Keys: "0, "1, "9

"0 holds your most recent yank; it never updates on delete. "1 holds your most recent multi-character delete; "2 the one before, and so on through "9. They shift on every delete.

Vim quietly keeps a backlog of your recent yanks and deletes. "0 is your most recent yank. "1 through "9 are the last nine deletes โ€” they shift down on each new one.

The numbered registers

Worked example โ€” "1p and "2p

Walk back through deletion history.

Step 1 ยท
registers.numbered
Step 2 ยท dd ยท dd โ€” A goes to "1.
dd โ€” A goes to "1.
Step 3 ยท dd ยท dd โ€” B goes to "1, A pushed to "2.
dd โ€” B goes to "1, A pushed to "2.
Step 4 ยท "1p ยท "1p โ€” most recent (B) back.
"1p โ€” most recent (B) back.
Step 5 ยท "3p ยท "2p โ€” older one (A) back.
"2p โ€” older one (A) back.

"1-"9 hold the last 9 line-deletes. They shift each time you delete.

โ–ถ Try this in the simulator

See also: Registers, The Unnamed Register, The Small Delete Register, Walking the Numbered Registers