From b3b2d2f3016d4c649df35f0627915e03ae739672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Tue, 23 Feb 2016 22:13:06 +0100 Subject: [PATCH] Fix #371: Tikz indentation --- indent/tex.vim | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/indent/tex.vim b/indent/tex.vim index ab93141..e667cb6 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -104,13 +104,10 @@ function! VimtexIndent() " {{{1 endif " Indent tikz elements - if pline =~ s:tikz_commands + if pline =~# s:tikz_commands && pline !~# ';' let ind += &sw - let s:tikz_indented += 1 - endif - if s:tikz_indented > 0 && pline =~# ';' + elseif pline !~# s:tikz_commands && pline =~# ';' let ind -= &sw - let s:tikz_indented -= 1 endif return ind @@ -131,18 +128,18 @@ endfunction " }}}1 " {{{1 Script variables -let s:tikz_indented = 0 " Define some common patterns let s:envs_lists = 'itemize\|description\|enumerate\|thebibliography' let s:envs_noindent = 'document\|verbatim\|lstlisting' -let s:tikz_commands = '\\\(' . join([ +let s:tikz_commands = '\v\\%(' . join([ \ 'draw', \ 'fill', \ 'path', \ 'node', - \ 'add\(legendentry\|plot\)', - \ ], '\|') . '\)' + \ 'coordinate', + \ 'add%(legendentry|plot)', + \ ], '|') . ')' " }}}1