Added initial indent support for tikz commands
This commit is contained in:
parent
c0a828b496
commit
02dd1eb587
@ -3,6 +3,7 @@ if exists("b:did_indent")
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
let s:cpo_save = &cpo
|
||||
let s:tikz_indented = 0
|
||||
set cpo&vim
|
||||
|
||||
" {{{1 Options and common patterns
|
||||
@ -36,6 +37,12 @@ let s:delimiters_close = '\(' . join([
|
||||
\ '\\\Cright\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||
\ '\\\cbigg\?\()\|\]\|\\}\)',
|
||||
\ ], '\|') . '\)'
|
||||
let s:tikz_commands = '\(' . join([
|
||||
\ 'draw',
|
||||
\ 'path',
|
||||
\ 'node',
|
||||
\ 'add\(legendentry\|plot\)',
|
||||
\ ], '\|') . '\)'
|
||||
" }}}1
|
||||
|
||||
" {{{1 LatexIndent
|
||||
@ -118,6 +125,16 @@ function! LatexIndent()
|
||||
let ind -= &sw
|
||||
endif
|
||||
|
||||
" Indent tikz elements
|
||||
if pline =~ s:tikz_commands
|
||||
let ind += &sw
|
||||
let s:tikz_indented += 1
|
||||
endif
|
||||
if s:tikz_indented > 0 && pline =~ ';\s*$'
|
||||
let ind -= &sw
|
||||
let s:tikz_indented -= 1
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
"}}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user