From 8d2f8382051202c7f54a9dfe0805928ad47c3751 Mon Sep 17 00:00:00 2001 From: Miao Jiang Date: Tue, 15 Jan 2019 22:56:58 +0800 Subject: [PATCH] Fix jump incorrect --- plugin/auto-pairs.vim | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index d329bb5..ad2e8f5 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -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 "\" end end @@ -285,6 +285,15 @@ func! AutoPairsDelete() return repeat("\", s:ulen(b)).repeat("\", s:ulen(a)) end endfor + + return "\" + " delete the pair foo[]| 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 "\" endf