How do I uppercase text inside an HTML tag without changing the tags?
vitU
When editing markup-heavy files, you often need to transform only the tag contents while preserving the surrounding structure.
640 results for "/pattern"
vitU
When editing markup-heavy files, you often need to transform only the tag contents while preserving the surrounding structure.
qa Yp <C-a> q
By combining a macro with (increment number), you can quickly generate numbered sequences.
"ayyj"Ayyk"ap
Named registers are much more powerful when you treat them as accumulators instead of one-shot clipboards.
:s/\v\d+/\=printf('%04d', submatch(0))/g
Substitution expressions let Vim compute each replacement dynamically, which is ideal when plain capture groups are too limited.
:smagic/\vfoo.+/bar/
If you prefer very-magic regex syntax but don't want to change global settings, :smagic is a targeted solution.
*NgUgn
gn is often treated as a visual selection command, but it is more powerful when used as a motion target for operators.
:%s/\v(\d+)/\=printf('%04d', submatch(1))/g
When you need stable-width numeric fields, manual edits are slow and error-prone.
command-line #command-line #substitution #regex #refactoring
<C-w>z or :pclose
The preview window shows file contents temporarily without switching your editing context.
buffers-windows #buffers-windows #quickfix #preview #navigation
:%s/\n\{3,}/\r\r/g
When files pass through formatters, generators, or repeated edits, they often accumulate noisy vertical gaps.
qagUiwWq2@a
Macros are most powerful when they encode both the edit and the movement to the next target.
:%!python3 -m json.tool
The :%! command pipes the entire buffer through an external command and replaces it with the output.
command-line #command-line #shell #formatting #json #workflow
qa...@aq
A recursive macro calls itself at the end of its recording, causing it to repeat until a motion or search fails.
:%s/\w\+/(&)/g
In a Vim substitution, & in the replacement string expands to the entire matched text.
:%s/\v\d+/\=printf('%04d', submatch(0))/g
When you need aligned numeric data for logs, IDs, or generated fixtures, manual edits are slow and error-prone.
"1pu.u.u.
Vim stores the last 9 deletions in numbered registers 1-9, with the most recent in register 1.
:&&
After running a :s/pattern/replacement/g command, you often need to repeat it on another line or range.
:keepjumps normal! gg
Sometimes you need to make a quick structural move (for example, jump to top, inspect context, then return) without polluting jump navigation history.
yiww"_ciw\<C-r>0\<Esc>
When you are doing repetitive refactors, cw is fast but it overwrites the unnamed register with the replaced text.
:keepjumps normal! gg=G<CR>
Whole-buffer reindent is common, but doing it naively can pollute your jumplist and break navigation flow during review.
:%normal @q
To apply a macro to every line in the file, use :%normal @q.