briandoll / change-inside-surroundings.vim

vim plugin to change the contents of the innermost 'surrounding'
http://briandoll.github.com/change-inside-surroundings.vim/
45 stars 7 forks source link

single undo of `<Leader>ci` #7

Open goodell opened 12 years ago

goodell commented 12 years ago

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.

goodell commented 12 years ago

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.