Closed blasco closed 5 years ago
I think what is happening is the undo operation is created after leaving insert mode, which means the call to repeat#set()
is superseded. You could maaaaaaybe leverage InsertLeave
to pull this off, or some other clever trick, but I think you're on your own to figure that out.
Ok, thanks for the guidance.
If possible, could you clarify me a little bit how it works? Because there is only one call repeat#set()
, which from what I've seen needs to be placed just after the operation is finished? But how does it know when it started? How does it know to what text object it applies?
I don't know that it can be done, but I would start by setting a private variable to b:changedtick
in your function (and another variable for the text object etc) and then check that it's 1 higher in InsertLeave
.
I'm trying to make the following operators repeatable:
https://github.com/mwgkgk/vim-operator-insert
I tried adding:
But when I do
giiw
(go insert in word) and insert something, when I repeat it doesn't repeat the wholegiiw
, it just inserts at the current cursor position:giiw
and typenew_
ge
then.
instead of
Any idea on how to approach this? I think an insert and append operator would be quite useful (specially combined with vim-targets)