How do I perform arithmetic calculations and insert the result without leaving insert mode?
The expression register ("=) lets you evaluate any Vimscript expression and insert the result directly into the buffer — all without leaving insert mode.
category:
registers
tags:
#registers
#insert-mode
#editing
#ex-commands
How do I save a macro permanently in my vimrc?
How it works Macros recorded with q are stored in registers, but they are lost when you close Vim (unless you have the viminfo or shada file preserving them).
category:
macros
tags:
#macros
#registers
#config
What is the difference between the star register and the plus register?
How it works Vim has two system clipboard registers that interact with the operating system: " -- the selection register (PRIMARY selection on Linux/X11, clipbo
category:
registers
tags:
#registers
#editing
#config
How do I use the alternate file register to quickly reference the previous file?
"#p or <C-r># in insert mode
The # register always contains the name of the alternate file — typically the file you were editing just before the current one.
category:
registers
tags:
#registers
#buffers
#file-management
#workflow
How do I inspect what key sequences are stored in a macro register?
When a macro behaves unexpectedly, :echo strtrans(@q) reveals exactly what is stored in register q—including invisible control characters—as human-readable
category:
macros
tags:
#macros
#registers
#debugging
How do I paste over a visual selection and automatically save the replaced text to a register?
When you visually select text and press p, Vim replaces the selection with the contents of the default register and saves the replaced text into the unnamed reg
category:
visual-mode
tags:
#visual-mode
#registers
#editing
#paste
How do I paste register contents literally without triggering mappings in insert mode?
In insert mode, a pastes register a but processes the text as if typed, which can trigger abbreviations and mappings.
category:
registers
tags:
#registers
#insert-mode
#paste
#literal
How do I put a register as true line list so embedded newlines stay split correctly?
Most register pastes are character-oriented, but advanced edits often need to preserve exact line structure.
category:
registers
tags:
#registers
#ex-commands
#scripting
#text-processing
How do I delete or change text without overwriting my previously yanked text?
Vim's black hole register (") acts as a write-only sink: anything sent to it is discarded without affecting any other register, including the unnamed register (
category:
registers
tags:
#registers
#delete
#editing
#normal-mode
How do I debug a macro by stepping through it command by command?
:let g:debug_macro=1 | normal @a
When a macro doesn't work as expected, debugging it step by step is essential.
category:
macros
tags:
#macros
#debugging
#troubleshooting
#registers
How do I execute Ex commands stored in a register instead of replaying it as normal-mode keys?
Most macro workflows focus on @q, which replays register q as normal-mode keystrokes.
category:
macros
tags:
#macros
#command-line
#automation
#registers
How do I programmatically set the contents of a register from the command line?
The :let @{reg} = expr command lets you assign any string or expression directly into a named register without entering insert mode or performing a yank.
category:
registers
tags:
#registers
#ex-commands
#macros
#normal-mode
How do I highlight all occurrences of a yanked word without typing a search pattern?
After yanking text, you can promote it directly to the search register with :let @/ = @".
category:
registers
tags:
#registers
#search
#hlsearch
#normal-mode
How do I force a register to be linewise before I put it in Vim?
:call setreg('a', @a, 'V')
When you paste from a register, Vim uses that register's stored type: characterwise, linewise, or blockwise.
category:
registers
tags:
#registers
#editing
#command-line
#setreg
How do I evaluate a Vim expression and paste the result directly from a register?
The expression register lets you compute text on demand and insert it without leaving Normal mode workflows.
category:
registers
tags:
#registers
#expression-register
#normal-mode
#automation
How do I record and replay a macro in Vim?
Macros let you record a sequence of commands and replay them.
category:
macros
tags:
#macros
#automation
#registers
#normal-mode
How do I change whether a register pastes as character, line, or block-wise?
:call setreg('"', @", 'l')
Vim registers carry not just their text content but also a type: charwise (c), linewise (l), or blockwise (b).
category:
registers
tags:
#registers
#editing
#normal-mode
#paste
How do I paste text from the system clipboard into Vim?
The "+p command pastes the contents of the system clipboard into Vim.
category:
registers
tags:
#registers
#editing
#normal-mode
How do I copy a named register into the system clipboard without yanking again?
If you already have carefully collected text in a named register, re-yanking just to reach the system clipboard is noisy and error-prone.
category:
registers
tags:
#registers
#clipboard
#command-line
#workflow
How do I paste or reuse my last search pattern?
Vim stores your last search pattern in the / register.
category:
registers
tags:
#registers
#search
#insert-mode
#command-line