SB
Size: a a a
SB
VL
SB
SB
VL
SB
SB
VL
VL
SB
SB
SB
VL
SB
VL
G
G
let s:pairs = ['{}', '()', '[]']
function! s:autoPair()
let line = getline('.')
let col = col('.')
let before = line[col - 2:col - 2]
let after = line[col - 1:col - 1]
for pairStr in s:pairs
if pairStr[0] == before &&
\ pairStr[1] == after
return "\<CR>\<CR>\<Up>\<Esc>cc"
endif
endfor
return "\<CR>"
endfunction
for pairStr in s:pairs
execute printf("inoremap <expr> %s '%s<\Left>'",
\ pairStr[0],
\ pairStr)
endfor
inoremap <expr> <CR> <SID>autoPair()
gо