mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-08 05:34:45 +08:00
ParenDelim: improve smart_matchpairs handling
* move the check up * only handle it when smart_matchpairs is configured (default)
This commit is contained in:
@@ -352,16 +352,17 @@ function! delimitMate#ParenDelim(right) " {{{
|
|||||||
endif
|
endif
|
||||||
let line = getline('.')
|
let line = getline('.')
|
||||||
let col = col('.')-2
|
let col = col('.')-2
|
||||||
let tail = len(line) == (col + 1) ? s:g('eol_marker') : ''
|
if s:g('smart_matchpairs') != ''
|
||||||
let smart_matchpairs = substitute(s:g('smart_matchpairs'), '\\!', left, 'g')
|
let smart_matchpairs = substitute(s:g('smart_matchpairs'), '\\!', left, 'g')
|
||||||
let smart_matchpairs = substitute(smart_matchpairs, '\\#', a:right, 'g')
|
let smart_matchpairs = substitute(smart_matchpairs, '\\#', a:right, 'g')
|
||||||
|
if line[col+1:] =~ smart_matchpairs
|
||||||
if s:g('smart_matchpairs') != '' &&
|
return left
|
||||||
\ line[col+1:] =~ smart_matchpairs
|
endif
|
||||||
return left
|
|
||||||
"elseif (col) < 0
|
|
||||||
" call setline('.',a:right.line)
|
|
||||||
endif
|
endif
|
||||||
|
let tail = len(line) == (col + 1) ? s:g('eol_marker') : ''
|
||||||
|
"if (col) < 0
|
||||||
|
" call setline('.',a:right.line)
|
||||||
|
"endif
|
||||||
return left . a:right . tail . repeat("\<Left>", len(split(tail, '\zs')) + 1)
|
return left . a:right . tail . repeat("\<Left>", len(split(tail, '\zs')) + 1)
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user