AlexB
AlexB

Reputation: 3548

How to replay a recursive macro recording once?

I started recording by typing qw.

Then, I pressed @w to replay the search,movement and replacement.

A couple of seconds after, I saw my replay in an infinite loop.

How can I only repaly my recording only once ?

Is this possible ? Should I use another vim command ?

Thanks in advance !

Upvotes: 0

Views: 91

Answers (1)

Jason
Jason

Reputation: 3917

Usually search and replace is done with :s. For example, to replace all foo with bar

:%s/foo/bar/g

See :help :s for more info.

To end a macro, type q in normal mode. So, a macro to move right, delete the next three characters, and move down would be typed as follows

qql3xjq

Then to replay the macro, @q or 3@q to execute it three times (:help q). Adding @q to the macro would make it recursive.

Upvotes: 1

Related Questions