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:

  1. yiw — Yank a word
  2. Move to another word
  3. "_diw — Delete without overwriting yank register
  4. P — 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 text
  • Ctrl+r " — Insert from unnamed register
  • Ctrl+r + — Insert from system clipboard
  • Ctrl+r / — Insert last search pattern
  • Ctrl+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.

Try It — Vim Cheat Sheet

Open full tool