mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-06 12:44:27 +08:00
Optimize IsEmptyPair.
This commit is contained in:
@@ -40,16 +40,19 @@ function! delimitMate#ShouldJump() "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! delimitMate#IsEmptyPair(str) "{{{
|
||||
for pair in b:_l_delimitMate_matchpairs_list
|
||||
if a:str == join(pair,'')
|
||||
if strlen(substitute(a:str, ".", "x", "g")) != 2
|
||||
return 0
|
||||
endif
|
||||
let idx = index(b:_l_delimitMate_left_delims, matchstr(a:str, '^.'))
|
||||
if idx > -1 &&
|
||||
\ b:_l_delimitMate_right_delims[idx] == matchstr(a:str, '.$')
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
for quote in b:_l_delimitMate_quotes_list
|
||||
if a:str == quote . quote
|
||||
let idx = index(b:_l_delimitMate_quotes_list, matchstr(a:str, '^.'))
|
||||
if idx > -1 &&
|
||||
\ b:_l_delimitMate_quotes_list[idx] == matchstr(a:str, '.$')
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user