Permalink
Browse files

fixes incorrect AutoPairsDelete

    [|{}
    ]

    press <BS> at | will become ]
  • Loading branch information...
1 parent 713a333 commit d59bc39f7529241a3a3dfe73b3429245969ae0f6 @jiangmiao committed Nov 28, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 plugin/auto-pairs.vim
View
@@ -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 "\<BS>". repeat("\<DEL>", 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*')

0 comments on commit d59bc39

Please sign in to comment.