How do I use a Vim expression to dynamically compute the replacement in a substitution?
:s/\d\+/\=submatch(0)+1/g
The \= prefix in a :substitute replacement field tells Vim to evaluate the following as a Vimscript expression rather than treating it as a literal string.
category:
registers
tags:
#search
#editing
#ex-commands
#registers
How do I capture shell command output directly into a Vim register?
You can populate any Vim register with the output of an external shell command using :let @{register} = system('{command}').
category:
registers
tags:
#registers
#ex-commands
#shell
How do I insert the current filename into the buffer or use it in commands?
Vim has several read-only registers that hold special values.
category:
registers
tags:
#registers
#insert-mode
#normal-mode
#editing
How do I programmatically combine or modify the contents of Vim registers?
You can manipulate register contents directly using the :let command with the @{reg} syntax.
category:
registers
tags:
#registers
#editing
#normal-mode
#ex-commands
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 a pattern in Vim without jumping the cursor to the next match?
Writing to the @/ register via :let @/ = 'pattern' sets Vim's last-search pattern directly — without performing a search or moving the cursor.
category:
registers
tags:
#registers
#search
#normal-mode
#ex-commands
How do I access and manipulate the last search pattern as a register?
Vim stores the last search pattern in the special / register.
category:
registers
tags:
#registers
#search
#command-line
How do I recover the last small deletion without disrupting my numbered registers?
Vim silently stores every deletion of less than one line in the special "- register (the "small delete" register).
category:
registers
tags:
#registers
#editing
#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 insert the result of a Vim expression or calculation directly into text?
The expression register ("=) lets you evaluate any Vim expression and insert its result as text.
category:
registers
tags:
#registers
#insert-mode
#editing
#ex-commands
How do I paste from a register in insert mode without Vim interpreting special characters?
In insert mode, {reg} pastes from a register but treats certain bytes as key inputs — so a register containing \n triggers a newline, \x08 triggers backspace,
category:
registers
tags:
#registers
#insert-mode
#editing
#paste
How do I modify the contents of a register without re-recording it?
:let @a = substitute(@a, 'old', 'new', 'g')
After recording a macro or yanking text into a named register, you may need to tweak it — fix a typo in a recorded macro, change a variable name in yanked tex
category:
registers
tags:
#registers
#macros
#ex-commands
#editing
How do I paste a register in insert mode without triggering auto-indent?
When you use a in insert mode to paste register a, Vim inserts the text as if you typed it character by character.
category:
registers
tags:
#registers
#insert-mode
#indentation
#editing
How do I paste the contents of a register into the command line or search prompt?
When typing an Ex command or search pattern, you often need to insert text you've already yanked or deleted.
category:
registers
tags:
#registers
#command-line
#search
#editing
How do I copy or transfer text between Vim registers?
Vim's :let @{reg} syntax lets you read from one register and write to another.
category:
registers
tags:
#registers
#ex-commands
#editing
#command-line
How do I cycle through previously deleted text using numbered registers?
"1p then u then . to cycle
Vim stores your last 9 deletions in numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#undo-redo
#delete
#paste
How do I record a macro directly into the system clipboard register?
You can record macros into any register, including the system clipboard (+).
category:
registers
tags:
#registers
#macros
#clipboard
#recording
How do I view or manipulate the search pattern register in Vim?
The / register holds the most recent search pattern.
category:
registers
tags:
#registers
#search
#pattern
#special-registers
How do I cycle through numbered registers to find a previous deletion?
Vim stores the last 9 deletions in numbered registers 1-9, with the most recent in register 1.
category:
registers
tags:
#registers
#numbered
#undo
#history
How do I yank text inside delimiters into a specific named register?
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
category:
registers
tags:
#registers
#text-objects
#yank
#delimiters