Optimize IsEmptyPair.

This commit is contained in:
Israel Chauca Fuentes
2012-02-08 03:41:11 -05:00
parent 5cc5d8d9b3
commit 8749708115

View File

@@ -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 "}}}