terryma / vim-multiple-cursors

True Sublime Text style multiple selections for Vim
MIT License
7.94k stars 247 forks source link

[Feature] Support consistent undo behavior #22

Closed terryma closed 11 years ago

terryma commented 11 years ago

Currently the plugin's undo behavior is unpredictable, both inside and outside of multicursor mode. For example, text inserted into the buffer during multicursor mode is undone one character at a time in all virtual cursor locations. The correct behavior should be consistent with Vim - everything entered during insert mode before exiting back to normal mode is 1 undo block.

Implementing this might require some clever hackery with using undojoin, further investigation is needed.

d11wtq commented 11 years ago

I can confirm that this now behaves much more sanely. I did just manage to get it to do something odd, but I can't reproduce it now, as I'm not sure what I did. It undid everything I inserted as a single batch, but the file-modified status was showing 59 changes. Pressing u 59 times made Vim agree there were no changes, but nothing was actually being changed at all. I can live with that though... I was mashing keys right before it trying to make #28 break (happy to say unsuccessfully).