How can I repeat the last VIM macro?

VimVim Macros

Vim Problem Overview


I know how to repeat the last command in Vim. I use ..

But how can I repeat the last macro? It's a little non-comfortable to press @q everytime I want to repeat it.

I tried with . but it just repeats the last command from the macro.

Is there a shorter way of doing that?

Vim Solutions


Solution 1 - Vim

Yes, you can use @@ to replay the last used macro.

As a bonus, use @: to replay the last ex command. (And then that becomes the "last used macro" that can be repeated with @@.)

Solution 2 - Vim

I find @@ a bit hard to type and as I don't use , much - and it's close enough to .:

:map , @@

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIonică BizăuView Question on Stackoverflow
Solution 1 - VimjohnView Answer on Stackoverflow
Solution 2 - VimGoblinhackView Answer on Stackoverflow