On 9/28/06, Karl Guertin <[EMAIL PROTECTED]> wrote:
I'm trying to get vim to auto-close parenthesis and set it up so that the closing paren jumps past the end of the inserted one. This mapping does the trick
A followup. I do have this working inoremap ()<C-R>=NoUndoMove(-1)<CR> inoremap ) <C-R>=JumpTo(')').NoUndoMove(1)<CR> function JumpTo(char) undojoin | exe 'normal f'.a:char return "" endf function NoUndoMove(offset) call cursor(line('.'),col('.)+a:offset) endf Which does the movement without changing the undo stack. Hoorah. Unfortunately, repeat (.) doesn't seem to repeat the cursor command. It also doesn't repeat setpos() and setline(). As a result, the parens move to the beginning of the insert on the repeats. E.g. typing "(abc" shows up as "(abc|)" where | is the cursor position. Repeating the insert gets me "()abc|". Any tips would be appreciated.