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 Normal mode commands (Editing) Repeat the Last Change Your cursor will be at position 1 of line 1, and all you need to do to fix the next two lines is press j. twice - that is, j to move down a line and . to repeat the last change, which was the addition of the I .
The " @: " command repeats the last command-line change (a command invoked with " : ", for example :s/old/new/ ). You can move the cursor before using either of the repeat commands. Suppose you press dd to delete a line. Next, you might move the cursor, then press 5.
6) actually persists macros and named buffers automatically (by default, although I haven't looked for a way of turning this behavior off). Closing a Vim session will update the ~/. viminfo file with any named buffers / macros.
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 @@.)
I find @@ a bit hard to type and as I don't use ,
much - and it's close enough to .
:
:map , @@
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With