Prevent jumping multi line if open pair equals close pair
This commit is contained in:
parent
ea2fd8a2de
commit
423ee192c7
@ -342,7 +342,7 @@ Multibyte Pairs
|
|||||||
input: h<|> press <BS>
|
input: h<|> press <BS>
|
||||||
output: h|
|
output: h|
|
||||||
|
|
||||||
pair: '\ws<': '>' (WRONG pair which missed \zs)
|
pair: '\w<': '>' (WRONG pair which missed \zs)
|
||||||
input: h<|> press <BS>
|
input: h<|> press <BS>
|
||||||
output: | (charactor 'h' is deleted)
|
output: | (charactor 'h' is deleted)
|
||||||
|
|
||||||
|
@ -114,12 +114,12 @@ func! s:backspace(s)
|
|||||||
return repeat("\<BS>", s:ulen(a:s))
|
return repeat("\<BS>", s:ulen(a:s))
|
||||||
endf
|
endf
|
||||||
|
|
||||||
func! s:getline()
|
func! s:getline(...)
|
||||||
let line = getline('.')
|
let line = getline('.')
|
||||||
let pos = col('.') - 1
|
let pos = col('.') - 1
|
||||||
let before = strpart(line, 0, pos)
|
let before = strpart(line, 0, pos)
|
||||||
let after = strpart(line, pos)
|
let after = strpart(line, pos)
|
||||||
if g:AutoPairsMultilineClose
|
if a:0 == 0 && g:AutoPairsMultilineClose
|
||||||
let n = line('$')
|
let n = line('$')
|
||||||
let i = line('.')+1
|
let i = line('.')+1
|
||||||
while i <= n
|
while i <= n
|
||||||
@ -186,6 +186,9 @@ func! AutoPairsInsert(key)
|
|||||||
" check close pairs
|
" check close pairs
|
||||||
for [open, close] in b:AutoPairsList
|
for [open, close] in b:AutoPairsList
|
||||||
if a:key == g:AutoPairsWildClosedPair || close[0] == a:key
|
if a:key == g:AutoPairsWildClosedPair || close[0] == a:key
|
||||||
|
if open == close
|
||||||
|
let [before, after] = s:getline(0)
|
||||||
|
end
|
||||||
let m = s:matchbegin(after, '\v\s*\zs\V'.close)
|
let m = s:matchbegin(after, '\v\s*\zs\V'.close)
|
||||||
if len(m) > 0
|
if len(m) > 0
|
||||||
" skip close pair
|
" skip close pair
|
||||||
|
Loading…
Reference in New Issue
Block a user