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.
795 results for "G"
: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.
gp
The standard p command pastes text after the cursor but leaves the cursor at the beginning of the pasted text.
:set grepprg={cmd} grepformat={fmt}
Vim's :grep command delegates to an external tool defined by grepprg, then parses the output according to grepformat to populate the quickfix list.
<C-w>}
How it works The } command opens a preview window showing the tag definition of the word under your cursor.
"qp
Macros are stored as plain text in named registers.
grr
Since Neovim 0.
\%'m
Vim's \%'m regex atom matches the exact position of mark m in a search pattern.
gl{motion}{char}
vim-lion (by Tom McDonald) adds gl and gL as alignment operators.
<C-v> (in visual mode)
Once you are in any visual mode, pressing v, V, or switches to charwise, linewise, or blockwise visual mode respectively — without cancelling the current sele
<Up>
In Vim's command line, and navigate history in prefix-filtered mode — they only cycle through past commands that begin with whatever you have already typed.
l (in :%s///gc confirm prompt)
When running an interactive substitution with the c flag (e.
editing #search #editing #substitution #ex-commands #normal-mode
dgn
The gn motion is a versatile text object that selects the next occurrence of the last search pattern.
editing #editing #search #text-objects #normal-mode #motions
: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
\@= and \@<=
Vim's regex engine supports zero-width lookahead and lookbehind assertions — \@= and \@<= — which let you match text based on surrounding context without in
:command -range {Name} ...
Custom Ex commands defined with :command -range can be called with a line range (e.
:s/\%Vfoo/bar/
The \%V atom in Vim's regex engine matches only within the area of the last visual selection.
search #search #visual-mode #substitute #advanced #ex-commands
:set inccommand=nosplit
When you are crafting a risky :substitute command, the expensive part is usually confidence, not typing.
\v
Vim's default regex mode ("magic") requires backslashes before many special characters: \(, \ , \+, \{.
:/pattern1/,/pattern2/
Ex command ranges in Vim are not limited to line numbers and marks — you can use /pattern/ as a range boundary to select lines between any two matching patter
/\%>80v.
The pattern /\%>80v.