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
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
|
let s:tikz_indented = 0
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
" {{{1 Options and common patterns
|
" {{{1 Options and common patterns
|
||||||
@ -36,6 +37,12 @@ let s:delimiters_close = '\(' . join([
|
|||||||
\ '\\\Cright\s*\%([^\\]\|\\.\|\\\a*\)',
|
\ '\\\Cright\s*\%([^\\]\|\\.\|\\\a*\)',
|
||||||
\ '\\\cbigg\?\()\|\]\|\\}\)',
|
\ '\\\cbigg\?\()\|\]\|\\}\)',
|
||||||
\ ], '\|') . '\)'
|
\ ], '\|') . '\)'
|
||||||
|
let s:tikz_commands = '\(' . join([
|
||||||
|
\ 'draw',
|
||||||
|
\ 'path',
|
||||||
|
\ 'node',
|
||||||
|
\ 'add\(legendentry\|plot\)',
|
||||||
|
\ ], '\|') . '\)'
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
" {{{1 LatexIndent
|
" {{{1 LatexIndent
|
||||||
@ -118,6 +125,16 @@ function! LatexIndent()
|
|||||||
let ind -= &sw
|
let ind -= &sw
|
||||||
endif
|
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
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
"}}}
|
"}}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user