mirror of
https://github.com/Raimondi/delimitMate.git
synced 2026-10-08 21:15:21 +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:
1 parent
a1f21e8ef5
commit
1c45f7bbde
1 file changed
+10
-9
@@ -352,16 +352,17 @@ function! delimitMate#ParenDelim(right) " {{{
|
||||
endif
|
||||
let line = getline('.')
|
||||
let col = col('.')-2
|
||||
let tail = len(line) == (col + 1) ? s:g('eol_marker') : ''
|
||||
let smart_matchpairs = substitute(s:g('smart_matchpairs'), '\\!', left, 'g')
|
||||
let smart_matchpairs = substitute(smart_matchpairs, '\\#', a:right, 'g')
|
||||
|
||||
if s:g('smart_matchpairs') != '' &&
|
||||
\ line[col+1:] =~ smart_matchpairs
|
||||
return left
|
||||
"elseif (col) < 0
|
||||
" call setline('.',a:right.line)
|
||||
if s:g('smart_matchpairs') != ''
|
||||
let smart_matchpairs = substitute(s:g('smart_matchpairs'), '\\!', left, 'g')
|
||||
let smart_matchpairs = substitute(smart_matchpairs, '\\#', a:right, 'g')
|
||||
if line[col+1:] =~ smart_matchpairs
|
||||
return left
|
||||
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)
|
||||
endfunction " }}}
|
||||
|
||||
|
||||
Reference in new issue
Block a user