On Nov 30, 5:47 am, zhang listar <[email protected]> wrote: > :inoremap ( ()<ESC>i > :inoremap ) <c-r>=ClosePair(')')<CR> > :inoremap { {}<ESC>i > :inoremap } <c-r>=ClosePair('}')<CR> > :inoremap [ []<ESC>i > :inoremap ] <c-r>=ClosePair(']')<CR> > :inoremap < <><ESC>i > :inoremap > <c-r>=ClosePair('>')<CR> > > function ClosePair(char) > if getline('.')[col('.') - 1] == a:char > return "\<Right>" > else > return a:char > endif > endf > > I have added the lines above to my vimrc, but vim does't automatically > complete bracket, > What's wrong with my vim? > The vimrc is as follows: >
I don't see the content above in your .vimrc you posted. Are you sure you added it? On a related note, I like using <Left> instead of <Esc>i in the mappings I have that do similar things. Fewer side effects. See our tip on the subject: http://vim.wikia.com/wiki/Automatically_append_closing_characters -- 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
