Vim Registers Cheatsheet

Types of Registers

Register Description
"0 to "9 Numbered registers. "0 contains last yank, "1-"9 contain last deletes
"a to "z Named registers for user storage
"" Unnamed register, last delete or yank
"* Selection register (X11 primary)
"+ Clipboard register
"_ Black hole register (discards text)
"% Current file name
"# Alternate file name
": Last executed command
". Last inserted text
"= Expression register for calculations

Using Registers

Command Description
"ay Yank into register a
"Ay Append yank to register a
"ap Paste from register a
"+y Yank into clipboard
"+p Paste from clipboard
:reg View contents of all registers
:reg a View contents of register a

Special Register Operations

Command Description
Ctrl-R a Insert contents of register a (in insert mode)
Ctrl-R = Insert result of expression (in insert mode)
:put a Put contents of register a on new line
q{register} Record macro into specified register
@{register} Execute macro from specified register

Tips and Tricks

Note: Register operations can be combined with motions and counts. For example, "a3yy yanks 3 lines into register a.