It would be great if typing <Leader>ci, then some replacement text, then <Esc>, then u would restore the state back to the way things were before the change command. Right now you need to undo twice, once for the actions of the s:ChangeSurrounding function and once for the text added as part of the startinsert that begins at the end of that function.
I tried to hack the script up to use undojoin, especially undojoin | startinsert, but it didn't work. I'm not sure if I'm lacking the vim-fu or if this is a fundamental (and stupid) limitation of vim's undojoin behavior.
The way to go might be to use real "object" mappings more like argtextobj.vim. Then xnoremap <silent> ix [...] (and similar) to make cix and friends work. No more <Leader> at all then.
It would be great if typing
<Leader>ci
, then some replacement text, then<Esc>
, thenu
would restore the state back to the way things were before the change command. Right now you need to undo twice, once for the actions of thes:ChangeSurrounding
function and once for the text added as part of thestartinsert
that begins at the end of that function.I tried to hack the script up to use
undojoin
, especiallyundojoin | startinsert
, but it didn't work. I'm not sure if I'm lacking the vim-fu or if this is a fundamental (and stupid) limitation of vim'sundojoin
behavior.