in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

How to execute a VIM macro over a line range

Macros in VIM are extremely useful for making lots of changes.

One thing that has always bothered me though is that I couldn't run the macro over a movement or line range and had to run it manually for each line.

The secret sauce is the :norm command.

Say you have recorded a macro in the q register.

To apply it to lines 3 - 6 use:

:3,6norm! @q

If you like VIM and want to learn more, I suggest you check out Aaron's screencasts.

Published Feb 06 2008, 05:17 AM by chrisortman
Filed under:

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
Powered by Community Server (Commercial Edition), by Telligent Systems