How do I copy or transfer text between Vim registers?
:let @+ = @"
Vim's :let @{reg} syntax lets you read from one register and write to another.
:let @+ = @"
Vim's :let @{reg} syntax lets you read from one register and write to another.
"1p then u then . to cycle
Vim stores your last 9 deletions in numbered registers "1 through "9.
"+q{keys}q
You can record macros into any register, including the system clipboard (+).
:echo @/
The / register holds the most recent search pattern.
"1pu.u.u.
Vim stores the last 9 deletions in numbered registers 1-9, with the most recent in register 1.
"ayi(
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
:nnoremap <leader>d "=strftime('%Y-%m-%d')<CR>p
The expression register (=) evaluates Vimscript expressions and uses the result as register content.
:echo @%
Vim provides special read-only registers that hold the current and alternate filenames.
@a (within macro @b)
Vim macros can call other macros, enabling modular macro composition.
:put =map(getreg('a', 1, 1), 'toupper(v:val)')
By using getreg() with the list flag and applying map(), you can transform register contents with any Vimscript function before pasting.
<C-r><C-r>a
In insert mode, a pastes register a but processes the text as if typed, which can trigger abbreviations and mappings.
:let @a = ''
Registers persist their contents throughout your Vim session and even across sessions if viminfo or shada is enabled.
:call setreg('a', @a, 'l')
Registers in Vim have a type — characterwise, linewise, or blockwise — that affects how their contents are pasted.
<C-r>=system("date")<CR>
The expression register (=) is one of Vim's most powerful yet underused features.
:let @+ = expand('%:p')
Sometimes you need to share or use the full path of the file you're editing — for a terminal command, a config file, or a chat message.
<C-r><C-o>{register}
The standard {reg} pastes register contents in Insert mode, but Vim may auto-indent multi-line text to match the current indentation level — sometimes manglin
"/p
Vim stores the last search pattern in the search register "/.
<C-r>0
In Insert mode, {reg} pastes the contents of any register inline at the cursor.
:put ={expression}
The :put command inserts the contents of a register as a new line below the cursor.
<C-r>:
Vim stores your last executed Ex command in the read-only : register.