Vim:Registers
lastmod 2023-04-06created 2023-04-061 edits
Notes on VIM registers.
Available registers
| | The named registers |
| | The numberered registers |
| | The unnamed register |
| | The small delete register |
| | Contains the file name (read only) |
| | Other read only registers |
| | The alternate buffer |
| | The expression register |
| | The selection and drop registers |
| | The last search pattern register |
| | The black hole register |
Types of registers
A register is one of the following three types.
- characterwise (character range)
- linewise (line range)
- blockwise-visual (block range)
The register type can be set with the third argument of setreg().
Reading and writing registers programmatically
In scripts and ex commands, a register value can be accessed by prefixing it with the at sign (@).
The value of a register with a dynamic name can be set with setreg().
Assigning to uppercase registers
Assigning a value to an uppercase register actually appends the assigned value to the value of the corresponding lowercase register.
Clearing register contents
A register (here, r) can be cleared as follows.
However, a few keystrokes can be saved by recording nothing into the register: qrq