Vim macros, from record-and-replay to reshaping thousands of lines

A Vim macro is a recorded sequence of keystrokes that you replay against a range, and it is the tool that beats sed, awk, and multi-cursor for irregular structural edits. This is the reference post: recording, replaying, applying over ranges, editing a macro as text in a register, recursive macros, and the specific patterns that make macros a daily tool. Fourth and final in the Vim series.

August 9, 2026 · 12 min · Omar Crosby