From d59bc39f7529241a3a3dfe73b3429245969ae0f6 Mon Sep 17 00:00:00 2001 From: Miao Jiang Date: Thu, 29 Nov 2012 03:19:04 +0800 Subject: [PATCH] fixes incorrect AutoPairsDelete [|{} ] press at | will become ] --- plugin/auto-pairs.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index b0d9b3a..95b6357 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -153,6 +153,10 @@ function! AutoPairsInsert(key) endfunction function! AutoPairsDelete() + if !b:autopairs_enabled + return a:key + end + let line = getline('.') let pos = col('.') - 1 let current_char = get(split(strpart(line, pos), '\zs'), 0, '') @@ -174,7 +178,7 @@ function! AutoPairsDelete() if match(line,'^\s*'.close, col('.')-1) != -1 let space = matchstr(line, '^\s*', col('.')-1) return "\". repeat("\", len(space)+1) - else + elseif match(line, '^\s*$', col('.')-1) != -1 let nline = getline(line('.')+1) if nline =~ '^\s*'.close let space = matchstr(nline, '^\s*')