Improve speed of s:is_verbatim
This commit is contained in:
parent
3e63a12448
commit
a070901fb2
@ -118,8 +118,9 @@ endfunction
|
||||
" }}}1
|
||||
|
||||
function! vimtex#env#is_inside(env) " {{{1
|
||||
let l:stopline = max([line('.') - 50, 1])
|
||||
return searchpair('\\begin\s*{' . a:env . '\*\?}', '',
|
||||
\ '\\end\s*{' . a:env . '\*\?}', 'bnW')
|
||||
\ '\\end\s*{' . a:env . '\*\?}', 'bnW', 0, l:stopline)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
@ -80,9 +80,8 @@ endfunction
|
||||
|
||||
" }}}1
|
||||
function! s:is_verbatim(line, lnum) " {{{1
|
||||
let l:env = a:line !~# '\v\\%(begin|end)\{%(verbatim|lstlisting|minted)'
|
||||
let l:syn = synIDattr(synID(a:lnum, 1, 1), 'name') ==# 'texZone'
|
||||
return l:env && l:syn
|
||||
return a:line !~# '\v\\%(begin|end)\{%(verbatim|lstlisting|minted)'
|
||||
\ && vimtex#env#is_inside('\%(lstlisting\|verbatim\|minted\)')
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
|
Loading…
Reference in New Issue
Block a user