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