mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Improve performance for skip
This commit is contained in:
@@ -596,7 +596,7 @@ function! s:get_matching_delims(down) dict " {{{1
|
||||
let l:open = matchup#delim#fill_backrefs(l:open, self.groups, 0)
|
||||
let l:close = matchup#delim#fill_backrefs(l:close, self.groups, 0)
|
||||
|
||||
let l:skip = 'matchup#delim#skip()'
|
||||
let l:skip = 'matchup#delim#skip0()'
|
||||
|
||||
if matchup#perf#timeout_check() | return [['', 0, 0]] | endif
|
||||
|
||||
@@ -1161,6 +1161,15 @@ function! matchup#delim#skip(...) " {{{1
|
||||
execute 'return (' b:matchup_delim_skip ')'
|
||||
endfunction
|
||||
|
||||
function! matchup#delim#skip0()
|
||||
if empty(b:matchup_delim_skip)
|
||||
return matchup#util#in_comment_or_string(line('.'), col('.'))
|
||||
endif
|
||||
|
||||
let s:eff_curpos = [line('.'), col('.')]
|
||||
execute 'return (' b:matchup_delim_skip ')'
|
||||
endfunction
|
||||
|
||||
let s:eff_curpos = [1, 1]
|
||||
|
||||
" effective column/line
|
||||
|
||||
@@ -12,9 +12,18 @@ function! matchup#pos#set_cursor(...) " {{{1
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
function! matchup#pos#get_cursor() " {{{1
|
||||
return exists('*getcurpos') ? getcurpos() : getpos('.')
|
||||
endfunction
|
||||
" function! matchup#pos#get_cursor() {{{1
|
||||
if exists('*getcurpos')
|
||||
function! matchup#pos#get_cursor()
|
||||
return getcurpos()
|
||||
endfunction
|
||||
else
|
||||
function! matchup#pos#get_cursor()
|
||||
return getpos('.')
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" }}}1
|
||||
|
||||
" }}}1
|
||||
function! matchup#pos#get_cursor_line() " {{{1
|
||||
|
||||
Reference in New Issue
Block a user