How do I copy the contents of one register to another?
:let @b = @a
The :let @b = @a command copies the contents of register a into register b.
351 results for "registers"
:let @b = @a
The :let @b = @a command copies the contents of register a into register b.
"ayv
Using named registers with visual mode lets you store multiple independent snippets simultaneously.
:reg a
The :reg a command shows the contents of register a, which reveals the keystrokes stored in the macro.
:let @a = ""
The :let @{register} = "" command empties a register.
"adiw
The "adiw command deletes the inner word under the cursor and stores it in register a.
:reg {name}
The :reg {name} command displays the current contents of one or more named registers in a formatted listing.
"ayi(
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
"{register}y{motion}
Vim has 26 named registers (a-z) that act as independent clipboards.
registers #registers #editing #normal-mode #yank #productivity
:let @q = @a . @b
Macros in Vim are stored as plain text in named registers.
"-p
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
"1p then u.u.u.
Vim stores your last 9 deletions (of one line or more) in the numbered registers "1 through "9.
registers #registers #editing #normal-mode #undo-redo #paste
:echo getregtype('a')
The getregtype() function returns the motion type of a register's content — whether it was yanked characterwise, linewise, or as a visual block.
y (in visual mode)
In visual mode, pressing y yanks (copies) the selected text into the default register.
"1p ... "2p ... "9p
Vim maintains a numbered register history from "1 through "9 that stores your last 9 deletes and changes.
":
The : register contains the last Ex command that was executed.
:let @a .= expand('%:t') . "\n"
Named registers are not just for yanks and deletes.
"ap, edit, "add
Since macros are stored in registers, you can paste the register content into the buffer, edit it, and yank it back.
"/ register
The / register contains the most recent search pattern.
:redir @a | command | redir END
The :redir command redirects Vim's command output to a register, file, or variable.
:let @a = getreg('0')
When you want to preserve a valuable yank before doing destructive edits, copying register 0 into a named register is safer than re-yanking text.
registers #registers #yanking #editing #command-line #refactoring