49
I wrote the RepeatLast.vim plugin to address this exact requirement. It provides a 5\. key binding to repeat the last 5 changes (including movements) and 2\D to drop/forget the last 2 actions.
It works by enabling macro recording all the time, which may not be desirable for everyone. But if you can live with that, it works in 99% of use cases.
Latest version: https://github.com/joeytwiddle/RepeatLast.vim (Please feedback!)
Caveats:
Please
:set ch=2so that the first line of output won't be hidden by the "recording" message.The 1% of times it fails to work as intended are usually due to:
- Difficulties triggering the CursorHold event slowly without losing fast-repeated keystrokes
- Undesirable recording of [Space] and [Enter] keys when the user is responding to a prompt.
Training your q muscle to pre-emptively record macros might be a better approach in the long term. ;-)