Yanking and deleting overwrites clipboard — where did the last three yanks go and how do you paste an older one?
Per Wikipedia: “Vim registers are named clipboards; unnamed ” holds last change, numbered 1-9 hold history, named a-z are explicit, +/* connect to system clipboard.”
Registers are like labeled jars — “a holds your pick, “1 holds yesterday’s pick, ”+ holds the shared jar with OS.
- Yank puts text in “0 and unnamed
- Delete puts in “1 shifting history
- Paste with “ap pastes register a
- “+p pastes system clipboard
- “:p pastes last command
- “0 preserves yank over delete
- ”_ is black hole — no save
- ”+ needs clipboard+ build
"ayy # yank line to a
"ap # paste from a
:reg # show all- Built from: Vim Modes — yank/paste across modes
- Related: Vim Visual Selection — visual yank uses registers
- Related: Vim Macros — macros stored in registers
- Related: Vim Buffers — registers are per-session not per-buffer
- Expecting unnamed to survive deletes — use “0
- Forgetting + vs * clipboard difference