How do I create a macro that runs continuously until it hits an error?
@q
A recursive macro is a macro that calls itself as its last step, causing it to loop automatically until an operation fails (such as reaching the end of the file
2125 results for "i" a""
@q
A recursive macro is a macro that calls itself as its last step, causing it to loop automatically until an operation fails (such as reaching the end of the file
"=expression<CR>p
The expression register ("=) lets you evaluate any Vimscript expression and paste the result directly into your buffer from normal mode.
registers #registers #editing #normal-mode #productivity #math
\{-}
In Vim's regex engine, \{-} is the non-greedy (lazy) quantifier — it matches as few characters as possible, unlike .
g<C-]>
When a symbol (function, class, variable) is defined in multiple places, CTRL-] blindly jumps to the first match.
<C-v>jjlU
Visual block mode lets you select rectangular regions of text, which means you can target a specific column and apply case changes only to that area.
%:t:r
Vim's % special character expands to the current filename and accepts a chain of colon-delimited modifiers.
command-line #command-line #ex-commands #editing #navigation
~
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to 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
"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
:set opfunc and g@
Vim's operatorfunc option lets you define your own operators — just like the built-in d, y, or c — that accept any motion or text object.
winsaveview() and winrestview()
When writing Vimscript functions or complex mappings that move the cursor, it is essential to restore the original view afterward so the user does not notice an
vim.highlight.on_yank()
After yanking text in Vim it can be hard to tell exactly what was captured, especially with larger motions or text objects.
set wildmode=longest:list,full
Setting wildmode=longest:list,full gives Vim a completion behavior similar to shells like bash and zsh.
:'<,'>normal! .
When you already made one correct edit, replaying it is usually safer than retyping it by hand.
:sort i
By default, :sort uses byte-value ordering, which places all uppercase letters before lowercase.
:set jumpoptions+=stack
By default, Vim's jumplist can feel surprising: if you jump backward and then make a new jump, the old forward path is not always discarded like a browser histo
o (visual mode)
In visual mode, pressing o swaps the cursor between the two ends of the selection (the anchor and the free end).
ct{char}
The ct{char} command deletes everything from the cursor up to (but not including) the specified character and drops you into insert mode.
editing #editing #motions #normal-mode #text-objects #productivity
\%>20c
The \%Nc, \%>Nc, and \%20c — match only after column 20 (i.
<C-w>H / <C-w>J / <C-w>K / <C-w>L
The H, J, K, and L commands move the current window to the far left, bottom, top, or right of the screen respectively, rearranging your entire split layout.
buffers-windows #windows #buffers #navigation #splits #layout