4 ms·
Yeah, I'd record that as a macro and replay it line by line I think.
by notJim 14y ago
Yeah, I'd record that as a macro and replay it line by line I think.
- LiveTheDream 14y agoMacros are the way I solve this as well. A little practice, and you won't even notice the difference. Just hit `Esc j` before ending the macro recording and moving down a line is no longer a problem :)
- irahul 14y agoRather 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.