I'd like to map 0 to whatever number of matches I currently have. For example:

enter image description here

This here has 5 matches. If I wanted to perform a macro on every instance, i'd like to be able to simply type:

0Q (Q is remapped as execute macro.)

which would be interpreted as:


Is this possible? Thanks.

1 Answer 1


You can use the global command to search for the pattern and then execute a command on the available pattern as such


which could be modified in your case as:

:global/pattern/normal @Q 

where pattern is the word on which you will run the macro and @Q is the macro register.

  • 1
    And you could omit the pattern: :global//normal @Q if you wanted to use the last search.
    – Tumbler41
    Mar 20, 2017 at 19:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.