Closed wellle closed 8 years ago
Thanks!
Thanks indeed! Now a lot of us are probably waiting for the patch to be merged by Neovim, if it hasn't been done already?!
Tests for this would indeed be very good!
:+1: this was bugging me for quite some time now :)
Thanks!
I was often intrigued by plugins that automatically close the delimiters I open, but there was always that one deal breaker: They wouldn't work properly with how Vim handle command repetition and undo.
Now that Vim added a way to let plugins like this move around in insert mode without breaking the undo chain, I thought I might give delimitMate another try. This PR uses that new feature if it's available to not break any insertions when moving left or right within the current line.
Since I'm not familiar with this plugin's code base, please let me know if I forgot some places where we should use the undo join or if I joined in places that shouldn't be joined. Also if the code should be arranged differently, I'm happy to do some cleanup.
For a simple test I typed in a new buffer Ia(b,"c which always leads to the following buffer content:
a(b,"c")
. Before the patch, pressingu
or.
would undo toa(b,"")
or repeat toa(b,"cc")
respectively.With the PR applied we undo to the empty line or repeat to
a(b,"c")a(b,"c")
instead. So the full operation is undone or repeated in a single operation, as expected. A Vim version before 7.4.849 is not affected by the patch and behaves as before.I see you have tests that I believe should be used for this. Maybe someone with more experience with this test setup would be more efficient in setting up those new tests. Otherwise I can take another look and see if I can add some.
Close #138. Related to: #50 #171 #184