0

Is there a way to repeat a normal mode sequence n times without making a macro for it?

I thought 5:norm would be able to do that, but that actually runs the normal mode sequence once for each line of the next 5 lines, it doesn't run the normal mode sequence 5 times

1 Answer 1

0

I think you are confusing "macro" and "recording", here. The result of a recording is indeed a macro, but the RHS of a mapping and the argument of :normal are also macros.

:normal being an Ex command, it is naturally line-oriented, which implies a certain way to handle [count].

:normal daw

deletes "a word", but:

5:normal daw

deletes "a word" on the current line and the four that follow.

But there is a way out of this. You know the @q you use to play back the macro stored in register q? Well, if you just executed:

:normal daw

then the : register contains:

:normal daw

and you can do @: to execute it again or 5@q to do it five times.


Of course, 5daw would have been easier, here, but that is all I could come up with… without you providing a proper example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.