No nonsense, directly on the code:
1 """""""""""""""""""""""""""""""""""""""""""2 "Auto Instance Brackets3 """""""""""""""""""""""""""""""""""""""""""4 ""Inoremap (() <ESC>I5Inoremap (<c-r>=openpair ('(',')') <CR>6Inoremap) <c-r>=closepair (')') <CR>7Inoremap {{}<esc>I8Inoremap} <c-r>=closepair ('}') <CR>9Inoremap [[]<esc>ITenInoremap] <c-r>=closepair (']') <CR> OneInoremap"<c-r>=quotedelim ('"') <CR> AInoremap'<c-r>=quotedelim ("' ") <CR> - -function!Openpair (CHAR1,CHAR2) theLet line = Getline ('.') -Let col = col ('.') - ifCol'$') ==Col - returnA:char1. A:char2."\<left>" + Else - returna:char1 + endif A endfunction at -function! Closepair (Char) - ifGetline'.') [Col ('.') -1] = = A:Char - return "\<right>" - Else - returnA:Char in endif - endfunction to +function! Quotedelim (Char) -Let line = Getline ('.') theLet col = col ('.') * ifLine[col-2] =="\\" $ "Inserting a quoted quotation mark into the stringPanax Notoginseng returnA:Char -ElseIf Line[col-1] = = A:Char the "escaping out of the string + return "\<right>" A Else the "starting a string + returnA:CharAChar."\<esc>i" - endif $Endf
My vim auto-instance parentheses function