From 8d78038f062bb8cdf0161f519480461ef5d5c296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Thu, 24 Mar 2016 12:52:45 +0100 Subject: [PATCH] Improve syntax in indent file --- indent/tex.vim | 90 +++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 49 deletions(-) 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), '\\\@