Consider:
apple
pear
Put your cursor on the first line and type Yp
, producing:
apple
apple
pear
Put your cursor on the pear
line and type .
to repeat the last command. This repeats only the p
(rather than the combination Yp
), producing:
apple
apple
pear
apple
I would like a way to tell .
to repeat the last N commands. Something like 2.
to repeat the combination Yp
to produce:
apple
apple
pear
pear
Ofc that won't work -- it repeats the p
twice. But the idea would be "repeat the sequence of the last 2 commands".
I know I can q
-record command sequences and the repeat them with @@
, but this solution isn't ideal, as it requires you to have been planning ahead all along, whereas in practice you often don't realize you need to repeat something until after you've done it.
Is there any way to achieve what I want?
Consolation prize: If the above is not possible, is there a way to repeat the last macro playback? Eg, if I typed @@
to playback my last macro, I'd like for the subsequent .
to be equivalent to typing @@
again -- which it is not (eg, if the result of @@
depends on the line you're on)
nno <silent> @@ @@:sil! call repeat#set('@@', v:count1)<CR>
But for it to work, you need to install this plugin: github.com/tpope/vim-repeat