Closed jedrzejboczar closed 2 years ago
Thanks for the implementation. Works flawlessly for me and I think the functionality is worth merging. However, I am not sure if we should make merging the undos the default behavior. I am certainly used to the way undo works now.
Sure, if you think it's better to keep the old behaviour, then it may be disabled by default. I initially set it to enabled as this undo-merging seemed more like the "expected" thing to me, but it may be just personal preference :) And it may be worth to avoid breaking changes. Feel free to modify it as you will or I can update the PR tomorrow if you want.
Nah, it's good. I'll change it in my config if I get to confused over time and change the default if too many people complain. Thanks again for the PR!
Closes https://github.com/matze/vim-move/issues/7.
With these changes, after each move operation we store
b:changedtick
and the move direction. When the function is called again it checks ifb:changedtick
is still the same. If it didn't change, then:undojoin
is called to merge the new change with the old one in undo history. The previous move direction is also compared and:undojoin
is used only if it is the same as current move direction.