How do I insert the output of any Vim Ex command directly into the current buffer?
The :put =execute('{cmd}') idiom inserts the output of any Vim Ex command as text in your buffer.
category:
registers
tags:
#registers
#ex-commands
#command-line
#normal-mode
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 collect all lines matching a pattern into a register without leaving them in place?
Using :g/pattern/d A you can sweep through the entire buffer and extract every line that matches a pattern into register a, removing them from the buffer in the
category:
registers
tags:
#registers
#ex-commands
#search
#editing
#global
How do I programmatically set a register's content in Vimscript to pre-load a macro?
:let @{reg} = 'string' directly assigns content to any named register from Vimscript.
category:
registers
tags:
#registers
#macros
#ex-commands
#normal-mode
How do I recover text from older deletions using Vim's numbered registers?
Vim automatically stores your deletion history in numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#normal-mode
#undo-redo
How do I programmatically load text or a macro into a named register from the command line?
:let @{register}=".
category:
registers
tags:
#registers
#macros
#command-line
#vimscript
How do I highlight a pattern without executing a search or moving the cursor?
Assigning a string directly to the search register @/ with :let causes Vim to highlight all matches (if hlsearch is enabled) without performing a search or movi
category:
registers
tags:
#registers
#search
#normal-mode
#ex-commands
How do I browse and restore previously deleted text using Vim's numbered registers?
"1p then u. to cycle through delete history
Vim silently maintains a rolling history of your last 9 deletions in numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#normal-mode
#undo-redo
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 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 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