Tip 60: Grok Vim's Registers
Return to the top: <<Practical Vim>>
Addressing a Register
"{register}
: specify a register
Vim's Terminology Versus the World
-
"_d{motion}
: true deletion
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote_
The Unnamed Register ("")
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote_quote
The Yank Register ("0)
When we use the y{motion}
command, the specified text is copied not only into the unnamed register but also into the yank register.
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote0
The Named Register ("a-"z)
When we address a named register with a lowercase letter, it overwrites the specified register, whereas when we use an uppercase letter, it appends to the specified register.
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote_alpha
The Black Hole Register ("_)
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote_
The System Clipboard ("+) and Selection ("*) Registers
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote+
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote*
Keystrokes | Buffer Contents |
"+
|
The X11 clipboard, used with cut, copy, and paste |
"*
|
The X11 primary, used with middle mouse button |
The Expression Register ("=)
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote=
More Registers
Read-only registers:
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote.
Register | Contents |
"%
|
Name of the current file |
"#
|
Name of the alternate file |
".
|
Last inserted text |
":
|
Last Ex command |
"/
|
Last search pattern |
The "/
register can be set explicitly using the :let
command.
References
# If you open the file in vim, # then you can \"ayy@a the next line to execute the vim command: :h quote/