Special Registers Deep Dive
%, #, :, ., /, =, _ โ the read-only and computed ones.
Beyond the named and numbered registers, Vim has a set of special registers that hold computed or context-dependent values: filename (%), alternate file (#), last command (:), last insert (.), last search (/), expression (=), and the black hole (_).
Beyond aโz and 0โ9, Vim has a handful of special registers that hold computed values. Most are read-only.
| Register | Holds | Common use |
|---|---|---|
| % | Current filename | "%p to paste filename |
| # | Alternate filename | Reference last edited file |
| : | Last Ex command | @: replays it |
| . | Last inserted text | ".p to paste what you just typed |
| / | Last search pattern | "/p to see the regex |
| = | Expression evaluator | "=1+1Enterp pastes 2 |
| _ | Black hole โ writes vanish | "_dd delete without affecting any other register |
| + | System clipboard | Cross-app cut/paste |
| * | X11 selection clipboard | Linux selection (middle-click) |
Watch
- ๐บ #0484 The : Register (not yet published)
- ๐บ #0486 The % Register (not yet published)
See also: Special Registers, Inserting from a Register