Insert open brackets when current bracket is open bracket.

OLD:
|[] + [ => [|]
|"" + " => "|"
NOW:
|[] + [ => [|][]
|"" + " => "|"
This commit is contained in:
jiangfriend@gmail.com 2011-05-25 02:37:25 +08:00
parent 33e6d1e312
commit 8d48d95dd8

View File

@ -36,7 +36,7 @@ function! AutoPairsInsert(key)
end
" Skip the character if current character is the same as input
if current_char == a:key
if current_char == a:key && !has_key(g:AutoPairs, a:key)
return "\<Right>"
end
@ -48,6 +48,10 @@ function! AutoPairsInsert(key)
let open = a:key
let close = g:AutoPairs[open]
if current_char == close && open == close
return "\<Right>"
end
" Auto return only if open and close is same
if prev_char == open && open != close