I have a file with a bunch of lines. I have recorded a macro that performs an operation on a single line. I want to repeat that macro on all of the remaining lines in the file. Is there a quick way to do this?
I tried Ctrl+Q, highlighted a set of lines, and pressed @@, but that didn’t seem to do the trick.
Use the normal command in Ex mode to execute the macro on multiple/all lines:
Execute the macro stored in register a on lines 5 through 10.
Execute the macro stored in register a on lines 5 through the end of the file.
Execute the macro stored in register a on all lines.
Execute the macro store in register a on all lines matching pattern.
To execute the macro on visually selected lines, press V and the j or k until the desired region is selected. Then type
:norm! @aand observe the that following input line is shown.Enter :help normal in vim to read more.