I believe undo has been discussed before, at least in the auto-pairs issues and also on the mailing list (can't find the thread, alas). Using arrow keys in insert mode breaks up undo, so in both delimitmate and autopairs, inserting (foo requires two u commands to undo the entire text. Obviously this isn't desirable as the user didn't explicitly exit insert mode, and expects the inserted text to be atomic. This also affects repeat.
I've found a way to "fix" undo/redo for delimitmate, and probably autopairs too:
inoremap ( <C-r>='()'<cr><esc>:undojoin<cr>i
Since <esc> moves the cursor to the left, the arrow keys are never touched. (AFAICT, arrow keys break :undojoin, and based on the vim_use thread, this is by design.)
Repeat . still doesn't work with this approach, but that could be solved easily with tpope's repeat.vim.
Any interest in applying this technique to delimitmate?
I've only tested on Vim 7.4.155 but this should work with previous versions.
I believe undo has been discussed before, at least in the auto-pairs issues and also on the mailing list (can't find the thread, alas). Using arrow keys in insert mode breaks up undo, so in both delimitmate and autopairs, inserting
(foo
requires twou
commands to undo the entire text. Obviously this isn't desirable as the user didn't explicitly exit insert mode, and expects the inserted text to be atomic. This also affects repeat.I've found a way to "fix" undo/redo for delimitmate, and probably autopairs too:
Since
<esc>
moves the cursor to the left, the arrow keys are never touched. (AFAICT, arrow keys break:undojoin
, and based on the vim_use thread, this is by design.)Repeat
.
still doesn't work with this approach, but that could be solved easily with tpope's repeat.vim.Any interest in applying this technique to delimitmate?
I've only tested on Vim 7.4.155 but this should work with previous versions.