Vim repeat a redo action

I was altering some code in Vim a little while ago. I had recently undone some warnings because I thought I didn’t need them any more. It turned out that I did. I started typing :redo :redo :redo and the changes were coming back gradually, but it was a pain to type the command each time.

In Vim the ‘.’ key repeats the last action, so I figured it would save me a lot of time to just press that instead. Bad idea! The ‘.’ character will not repeat the :redo command, it will repeat the action that the :redo caused. So if :redo inserted some text then pressing ‘.’ will cause that same section of text to be inserted again.

This is not only a bit annoying, but also causes a divergence from the history meaning you can no longer use :redo to get back to where you were going. 🙁

A useful shortcut for redo in Vim is Ctrl-r. I’m slowly becoming less of a Vim n00b.

Now I better get back to typing in all of my warns.

Leave a Reply

Your email address will not be published. Required fields are marked *