diff --git a/autoload/vimtex/env.vim b/autoload/vimtex/env.vim index 1378e31..327bf73 100644 --- a/autoload/vimtex/env.vim +++ b/autoload/vimtex/env.vim @@ -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 diff --git a/indent/tex.vim b/indent/tex.vim index 2c4188a..b55675a 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -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