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.
197 results for "registers"
:let @+ = @"
Vim's :let @{reg} syntax lets you read from one register and write to another.
"-p
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
:reg a
The :reg a command shows the contents of register a, which reveals the keystrokes stored in the macro.
"adiw
The "adiw command deletes the inner word under the cursor and stores it in register a.
"%p
Vim has several read-only registers that hold special values.
"1p ... "2p ... "9p
Vim maintains a numbered register history from "1 through "9 that stores your last 9 deletes and changes.
:let @a = @a . @b
You can manipulate register contents directly using the :let command with the @{reg} syntax.
"ayi(
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
qA
If you finish recording a macro and realize you forgot a step, you don't need to re-record the whole thing.
macros #macros #registers #normal-mode #editing #productivity
:wviminfo / :rviminfo
Vim can persist register contents (including macros) across sessions using viminfo (Vim) or shada (Neovim).
:let @a = ""
The :let @{register} = "" command empties a register.
"_d
The "d command deletes text using the black hole register ("), which discards the deleted content instead of storing it.
:let @q =
Instead of recording a macro with q, you can assign any string directly to a named register using :let @{register} = 'keys'.
<C-r>:
Vim stores your last executed Ex command in the read-only : register.
:let @/ = 'pattern'
Use :let @/ = 'pattern' to set the search register directly.
<C-r>%
In insert mode, % inserts the current filename.
5"ap
Prefix the paste command with a count.
<C-r>#
The # register holds the alternate (previously edited) filename.
:t {line-number}
The :t (copy/transfer) command duplicates the current line and places it after the specified line number.
q{a-z}...q
Recording a macro captures a sequence of keystrokes into a register, which you can replay later.