diff --git a/indent/tex.vim b/indent/tex.vim index e667cb6..72fe313 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -23,94 +23,86 @@ setlocal indentkeys+=[,(,{,),},],\&,=item function! VimtexIndent() " {{{1 " Find a non-blank non-comment line above the current line - let lnum = prevnonblank(v:lnum - 1) - while lnum != 0 && getline(lnum) =~# '^\s*%' - let lnum = prevnonblank(lnum - 1) + let l:nprev = prevnonblank(v:lnum - 1) + while l:nprev != 0 && getline(l:nprev) =~# '^\s*%' + let l:nprev = prevnonblank(l:nprev - 1) endwhile - - " Zero indent for top of file - if lnum == 0 + if l:nprev == 0 return 0 endif - " Get current and previous line, remove comments - let cline = substitute(getline(v:lnum), '\\\@