On Saturday, January 17, 2015 at 1:20:04 PM UTC-6, Bram Moolenaar wrote: > > Since undo works by saving the line before changing it, restricting the > "keep undo" modifier to only work when the cursor remains in the same > line should work. It's also fairly easy to understand, instead of > making a list of specific commands for which undo can be kept. > > Note that "." to repeat the insert may not always work properly. Need > to check that. >
Wow. WOW! Thanks for the patch, Christian! I tested with some fairly simple mappings, and it works perfectly! Even repeating these mappings with '.' and inserting in visual-block insert works without issue as far as I can tell! inoremap ( ()<C-G>U<Left> inoremap (<SPACE> (<SPACE><SPACE>)<C-G>U<Left><C-G>U<Left> inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<C-G>U\<Right>" : ")" The only thing that won't work smoothly is a mapping to insert a new indented line between pairs, but it's only repeat that is broken there, and I can live with that: inoremap <silent> {<CR> {<CR>}<Esc>zv:undojoin<CR>O I even got a smart mapping done for paired " characters that also works with Vim comments...but that uses some complicated regex so I'll not confuse the issue here :-) -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.