Vim Registers — Named, Numbered, and Special Registers
Deep dive into Vim's register system: named registers (a-z), numbered registers (0-9), special registers (+, *, /, :, .), and how to use them for advanced copy-paste workflows.
Registers
Detailed Explanation
Understanding Vim Registers
Registers are Vim's storage slots for text. Every yank, delete, and change stores text in a register.
Register Types
| Register | Description |
|---|---|
"" |
Unnamed register (default for d, c, y, p) |
"0 |
Last yanked text |
"1 - "9 |
Delete history (most recent = 1) |
"a - "z |
Named registers (you choose) |
"A - "Z |
Append to named register |
"+ |
System clipboard |
"* |
Primary selection (X11/macOS) |
"/ |
Last search pattern |
": |
Last command-line command |
". |
Last inserted text |
"% |
Current filename |
"# |
Alternate filename |
"_ |
Black hole register (discard) |
"= |
Expression register |
Using Registers
| Command | Action |
|---|---|
"ay{motion} |
Yank into register a |
"ap |
Paste from register a |
"Ay{motion} |
Append to register a |
"+y{motion} |
Yank to system clipboard |
"+p |
Paste from system clipboard |
:reg |
Show all register contents |
:reg abc |
Show specific registers |
The Black Hole Register
"_d{motion} deletes without affecting any register. Useful when you want to delete text without overwriting what you previously yanked:
yiw— Yank a word- Move to another word
"_diw— Delete without overwriting yank registerP— Paste the originally yanked word
Insert Mode Register Access
In Insert mode, Ctrl+r {register} inserts the contents of any register:
Ctrl+r 0— Insert last yanked textCtrl+r "— Insert from unnamed registerCtrl+r +— Insert from system clipboardCtrl+r /— Insert last search patternCtrl+r =— Evaluate an expression and insert the result
Use Case
You need to manage multiple clipboard contents simultaneously, work with the system clipboard, or use Vim's register system for complex text manipulation workflows.