Open SevereOverfl0w opened 6 years ago
Based on https://github.com/tpope/vim-repeat/issues/63#issuecomment-390281441 it seems like the best option is to avoid using repeat.vim and use an operatorfunc (g@
) instead.
Vim's b:changedtick
behavior is too unpredictable for repeat.vim to be reliable.
I tried to do the easiest solution with:
func! Foo(...)
call sexp#wrap('e', '(', ')', 0, g:sexp_insert_after_wrap)
endf
set opfunc=Foo
Then doing g@iwfoo
. When doing .
, the text "foo" was inserted, but not the wrapping parens, so I guess there's limitations to how far opfunc can repeat something.
This limitation might be overcome with the right change to vim-sexp however.
I can't quite figure out how to do this, I stumbled upon https://github.com/vim/vim/issues/202 which suggests that this is possible. The linked commit doesn't seem related though.
I've opened https://github.com/vim/vim/issues/3126 in the hopes of getting some information. I don't think it's currently possible to implement c
in user-code though. Maybe you will have some insight into that though @justinmk?
e.g.
<localleader>wdefn
should be therepeat#set
text instead of<localleaderw
alone. This makes it easier to repeat that kind of change, and would align the behavior witha
andi
for example.