How do I edit a macro without re-recording it?
:let @q = substitute(@q, 'old', 'new', '')
Vim macros are stored as plain text in named registers, which means you can inspect and modify them directly using :let and :echo.
57 results for "named register yank"
:let @q = substitute(@q, 'old', 'new', '')
Vim macros are stored as plain text in named registers, which means you can inspect and modify them directly using :let and :echo.
:let @a = @"
Vim's :let command lets you read and write register contents as strings, making it possible to copy, combine, or modify register values without ever leaving the
"Ay{motion}
Using an uppercase register letter with any operator appends to the register instead of replacing it.
{visual}p
When you visually select text and press p, Vim replaces the selection with the contents of the default register and saves the replaced text into the unnamed reg
gr{motion}
Neovim 0.
/<C-r>0
How it works After yanking text, you can use it directly as a search pattern by inserting the yank register contents into the search prompt.
@"
Vim macros are stored in registers — and you can execute any register as a macro with @{register}.
:<C-r>a
How it works While typing an Ex command on the command line (after pressing :), you can insert the contents of any register by pressing Ctrl-R followed by the r
:t {address}
How it works The :t command (short for :copy) copies one or more lines and places them below the specified address.
:reg a b c
The :reg (alias :registers) command accepts a string of register names as its argument.
yyp
The yyp command duplicates the current line by yanking it and immediately pasting it below.
y (in visual mode)
In visual mode, pressing y yanks (copies) the selected text into the default register.
viwp
The viwp command visually selects the word under the cursor and replaces it with the contents of the unnamed register (your last yank or delete).
visual-mode #editing #visual-mode #registers #paste #productivity
:let @/ = @"
After yanking text, you can promote it directly to the search register with :let @/ = @".
"qp
Macros are stored as plain text in named registers.
"qp {edit} 0"qy$ dd
When you record a macro and realize it has a mistake, the easiest fix is to paste the macro's keystrokes as text, edit them, and yank the corrected version back
:let @a = 'text'
Vim's :let command lets you assign a value directly to any named register without performing a yank or delete operation.
registers #registers #macros #vimscript #ex-commands #normal-mode
:let @a = @a . @b
You can manipulate register contents directly using the :let command with the @{reg} syntax.
<C-r>{register}
Pressing followed by a register name in insert mode inserts the contents of that register at the cursor position without leaving insert mode.
:let @a = '...'
When a recorded macro contains a typo or needs a small tweak, you can modify it directly via the :let command rather than re-recording the entire sequence.