Fix #371: Tikz indentation
This commit is contained in:
parent
67ce887efc
commit
b3b2d2f301
@ -104,13 +104,10 @@ function! VimtexIndent() " {{{1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent tikz elements
|
" Indent tikz elements
|
||||||
if pline =~ s:tikz_commands
|
if pline =~# s:tikz_commands && pline !~# ';'
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
let s:tikz_indented += 1
|
elseif pline !~# s:tikz_commands && pline =~# ';'
|
||||||
endif
|
|
||||||
if s:tikz_indented > 0 && pline =~# ';'
|
|
||||||
let ind -= &sw
|
let ind -= &sw
|
||||||
let s:tikz_indented -= 1
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
@ -131,18 +128,18 @@ endfunction
|
|||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
" {{{1 Script variables
|
" {{{1 Script variables
|
||||||
let s:tikz_indented = 0
|
|
||||||
|
|
||||||
" Define some common patterns
|
" Define some common patterns
|
||||||
let s:envs_lists = 'itemize\|description\|enumerate\|thebibliography'
|
let s:envs_lists = 'itemize\|description\|enumerate\|thebibliography'
|
||||||
let s:envs_noindent = 'document\|verbatim\|lstlisting'
|
let s:envs_noindent = 'document\|verbatim\|lstlisting'
|
||||||
let s:tikz_commands = '\\\(' . join([
|
let s:tikz_commands = '\v\\%(' . join([
|
||||||
\ 'draw',
|
\ 'draw',
|
||||||
\ 'fill',
|
\ 'fill',
|
||||||
\ 'path',
|
\ 'path',
|
||||||
\ 'node',
|
\ 'node',
|
||||||
\ 'add\(legendentry\|plot\)',
|
\ 'coordinate',
|
||||||
\ ], '\|') . '\)'
|
\ 'add%(legendentry|plot)',
|
||||||
|
\ ], '|') . ')'
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user