Ben Fritz wrote: > On Mon, Jul 8, 2013 at 1:59 PM, Bram Moolenaar <b...@moolenaar.net> wrote: > > > > Benjamin Fritz wrote: > > > >> On Thu, Jul 4, 2013 at 4:44 AM, Bram Moolenaar <b...@moolenaar.net> wrote: > >> > Does the delimitMate return the text to be inserted or does it use > >> > setline()? In the last case it can't be fixed really. > >> > >> It actually uses setline(). > > > > Why? What does it do that can't be done by returning a string? > > > > Type: > > iabc( > > get (where | is the cursor): > > abc(|) > > now continue typing 123) + 456; > > get: > > abc(123) + 456;| > > Note how the parenthesis got inserted automatically, but manually > entering ) did not insert a second ) but rather moved the cursor over > the existing one.
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 -- Violators can be fined, arrested or jailed for making ugly faces at a dog. [real standing law in Oklahoma, United States of America] /// 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.