4 ms·
Rather than replaying it line by line, you can play it over a range. If you do this in your vimrc: vnoremap @q :normal @q<CR> You can record the macro in
by irahul 14y ago
Rather than replaying it line by line, you can play it over a range. If you do this in your vimrc:
vnoremap @q :normal @q<CR>
You can record the macro in q register, select the visual range, and then do @q to run it over the range. The advantage of doing it thus is you don't have to run the macro manually on every line, and you can undo all change with one u.
Also, normal takes ranges(and not just visual ranges). If you want to run the macro recorded in q over lines 15,49, you can do:
:15,49normal @q<CR>
I use the same trick for repeating commands over a range too.
vnoremap . normal .<CR>
As usual, it doesn't have to be visual range. But I mostly use visual ranges, and so I have defined shortcuts for visual ranges.