
Vim commands I use when precision editing matters
Every Vim user builds a personal toolkit over time. The commands below are ones I kept bumping into — not in tutorials, but in the middle of actual work when the usual approach felt like one step too many. Each one solves a real friction point rather than just being clever for its own sake. 1) Recursive macros that stop themselves Why it matters When you record a macro to process N items, you usually need to know N in advance. Most people use a large count like 99@q and hope that's enough. A recursive macro is cleaner: it calls itself at the end of its body and stops automatically the moment any command in the sequence fails — no counting required. qqq qq { your commands } @qq @ q The first line ( qqq ) clears register q so the embedded @q at the end of the recording is a harmless no-op rather than invoking a stale old macro. Then you record your macro and include @q as the final keystroke. Once recorded, @q starts the loop. Real scenario You have a list of lines where each one needs t
Continue reading on Dev.to
Opens in a new tab


