Fix jump incorrect

This commit is contained in:
Miao Jiang 2019-01-15 22:56:58 +08:00
parent 2de4b15cc5
commit 8d2f838205

View File

@ -198,10 +198,10 @@ func! AutoPairsInsert(key)
end
end
if open != close
let m = s:matchend(after, '^\v\s*\zs\V'.close)
if len(m) > 0
let m = matchstr(after, '^\v\s*\zs\V'.close)
if m != ''
" skip close pair greedy
call search(m[1], 'We')
call search(m, 'We')
return "\<Right>"
end
end
@ -285,6 +285,15 @@ func! AutoPairsDelete()
return repeat("\<BS>", s:ulen(b)).repeat("\<DELETE>", s:ulen(a))
end
endfor
return "\<BS>"
" delete the pair foo[]| <BS> to foo
for [open, close] in b:AutoPairsList
let m = s:matchend(before, '\V'.open.'\v\s*'.'\V'.close.'\v$')
if len(m) > 0
return s:backspace(m[2])
end
endfor
return "\<BS>"
endf