How do I apply a macro to every line in a specific range without running it manually each time?
:[range]normal @q
The :[range]normal @q command replays the macro in register q on every line within a given range.
432 results for "visual mode"
:[range]normal @q
The :[range]normal @q command replays the macro in register q on every line within a given range.
:%!{cmd}
The :%!{cmd} command pipes the entire buffer through an external shell command and replaces the buffer contents with the command's output.
command-line #editing #ex-commands #shell #filtering #productivity
:[range]yank {reg}
Vim's :[range]yank and :[range]delete Ex commands let you capture arbitrary line ranges into a register from the command line, bypassing the need to move the cu
gqip
The gqip command reformats the current paragraph to fit within the configured textwidth.
highlight TrailingWhitespace ctermbg=red and match TrailingWhitespace /\s\+$/
How it works Vim's highlight and match commands let you create custom visual indicators.
( and )
How it works Vim defines a sentence as text ending with .
"=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
gq{motion}
The gq{motion} operator reformats text to fit within Vim's textwidth setting, inserting hard line breaks where lines are too long.
:Gitsigns stage_hunk
gitsigns.
<C-v> (command-line mode)
In command-line mode (after : or /), pressing followed by any key inserts that key literally — bypassing all key notation, mappings, and special interpretatio
d'a
Named marks are not just jump destinations — they serve as motion targets for any operator.
navigation #navigation #marks #editing #motions #normal-mode
:set cmdheight=2
The cmdheight option controls how many lines Vim reserves for the command-line area at the bottom of the screen.
g'{mark}
Vim's standard mark-jump commands ('a, ` a `) always add the current position to the jumplist before leaping to the mark.
:silent! %normal @q
Combining :silent!, the % range, and :normal @q gives you a powerful pattern for applying a macro across an entire file while gracefully skipping lines that don
"+y
The "+y command yanks (copies) text into the system clipboard register, making it available to paste in other applications outside of Vim.
g-
Vim's undo history is a tree, not a linear stack.
:r !command
The :r !command command executes a shell command and inserts its output directly into the current buffer below the cursor line.
:!command
The :!command syntax lets you execute any shell command directly from within Vim without leaving the editor.
<SID>
(Script ID) is a Vimscript token that expands to a unique, per-script prefix at runtime.
10@a
The 10@a command replays the macro recorded in register a exactly 10 times.