How do I edit a recorded macro to fix a mistake without re-recording it?
"ap, edit, 0"ay$
When a macro has a small mistake, re-recording the entire thing is tedious.
45 results for ":set paste"
"ap, edit, 0"ay$
When a macro has a small mistake, re-recording the entire thing is tedious.
q: or <C-f> from : prompt
The command-line window (q:) opens a full Vim buffer containing your Ex command history.
:let @a = @a . @b
You can manipulate register contents directly using the :let command with the @{reg} syntax.
"# register
The # register contains the name of the alternate file — the previously edited file in the current window.
qama{edits}'aq
How it works When a macro needs to jump to different parts of the file and then return to a starting position, marks are the perfect tool.
q:
The command-line window is a special buffer that shows your entire Ex command history and lets you edit entries using the full power of Vim's normal mode before
command-line #command-line #ex-commands #history #editing #productivity
:let @a = "value"
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.
oil.nvim: edit directory listing like a buffer
oil.
:let @/ = "pattern"
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
{count}{motion}
Almost every Vim motion and operator accepts a numeric count prefix that repeats or amplifies the action.
:call setreg('a', @a . 'text', 'l')
How it works Vim provides two functions for advanced register manipulation: setreg() and getreg().
let mapleader = ' ' then nnoremap <leader>key command
The leader key is a configurable prefix for your custom key mappings.
<C-r>=
The expression register (=) lets you evaluate Vimscript expressions on the fly and insert the result directly into your text.
registers #editing #insert-mode #registers #productivity #math
=i{
When editing code with messy indentation — after a paste, a merge conflict, or a refactor — you often need to fix just one block rather than the entire file
:let @q='commands'
Macros in Vim are stored in registers as plain text.
:let @q = substitute(@q, 'old', 'new', 'g')
When a recorded macro has a typo or needs a small tweak, re-recording the entire thing is error-prone.
n.
The n.
:%s//new/g
Leaving the search field empty in a :s command tells Vim to reuse the last search pattern from / or .
search #search #substitution #ex-commands #regex #productivity
:registers
The :registers command displays the contents of all Vim registers, showing you exactly what text is stored in each one.
:earlier
Vim's undo history is not just a linear list of changes — it records timestamps too.