Ben Fritz wrote: > On Tue, Jul 9, 2013 at 5:54 AM, Bram Moolenaar <b...@moolenaar.net> wrote: > > > > That can be done by returning cursor key sequences. No need for > > setline(): > > > > imap ( <C-R>=LeftParen()<CR> > > fun! LeftParen() > > return "()\<Left>" > > endfun > > imap ) <C-R>=RightParen()<CR> > > fun! RightParen() > > return "\<Right>" > > endfun > > > > I don't remember how setline() solves the problem, but just returning > cursor sequences doesn't work, because it breaks undo/redo/repeat.
Yeah, that's true. I suppose we could avoid saving for undo under certain conditions, but it's quite hard to decide what those conditions are. Perhaps "when inserting a register and the cursor remains within the inserted text"? > If I insert abc(123) with mappings like, then press '.' somewhere > else, I will only get the 123 inserted. Pressing 'u' after inserting > "abc(123) + 456" will only undo the " + 456". > > The mappings that used to work to get around this are complicated; > hence the reason I'm using a plugin instead of simple mappings; but > previously somehow using setline() allowed all of undo, redo, and > repeat to work as if there were not any mappings. Now only repeat > works. -- "I love deadlines. I especially like the whooshing sound they make as they go flying by." -- Douglas Adams /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.