Fix indent of \[ \] pairs (#307)
This commit is contained in:
parent
f4683e3439
commit
7411fdd6d5
@ -88,6 +88,14 @@ function! VimtexIndent() " {{{1
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Add/Subtract indent on begin/end displayed equation
|
||||||
|
if pline =~# '\\\[\s*$'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
if pline =~# '\\\]\s*$'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
|
||||||
" Indent opening and closing delimiters
|
" Indent opening and closing delimiters
|
||||||
let l:delimiters = match(map(synstack(v:lnum, max([col('.') - 1, 1])),
|
let l:delimiters = match(map(synstack(v:lnum, max([col('.') - 1, 1])),
|
||||||
\ 'synIDattr(v:val, ''name'')'), '^texMathZone') >= 0
|
\ 'synIDattr(v:val, ''name'')'), '^texMathZone') >= 0
|
||||||
@ -144,15 +152,11 @@ let s:delimiters_open_tex = '\(' . join([
|
|||||||
\ '{',
|
\ '{',
|
||||||
\ '\[',
|
\ '\[',
|
||||||
\ '\\(',
|
\ '\\(',
|
||||||
\ '\\\[',
|
|
||||||
\ '\\\Cbegin\s*{.\{-}}',
|
|
||||||
\ ], '\|') . '\)'
|
\ ], '\|') . '\)'
|
||||||
let s:delimiters_close_tex = '\(' . join([
|
let s:delimiters_close_tex = '\(' . join([
|
||||||
\ '}',
|
\ '}',
|
||||||
\ '\]',
|
\ '\]',
|
||||||
\ '\\)',
|
\ '\\)',
|
||||||
\ '\\\]',
|
|
||||||
\ '\\\Cend\s*{.\{-}}',
|
|
||||||
\ ], '\|') . '\)'
|
\ ], '\|') . '\)'
|
||||||
let s:delimiters_open_math = '\(' . join([
|
let s:delimiters_open_math = '\(' . join([
|
||||||
\ '\\{',
|
\ '\\{',
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
\tikz \fill[green] rectangle (0.5,0.5); Something
|
\tikz \fill[green] rectangle (0.5,0.5); Something
|
||||||
about something.
|
about something.
|
||||||
|
|
||||||
|
\[
|
||||||
|
1+1
|
||||||
|
\]
|
||||||
|
|
||||||
\begin{align}
|
\begin{align}
|
||||||
2+2=4
|
2+2=4
|
||||||
\end{align}
|
\end{align}
|
||||||
@ -16,10 +20,11 @@ about something.
|
|||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
\begin{equation}
|
\begin{equation}
|
||||||
\left\{
|
\left.
|
||||||
asdasd
|
f(x) = 3
|
||||||
\right\}
|
\right.
|
||||||
\end{equation}
|
\end{equation}
|
||||||
|
|
||||||
{
|
{
|
||||||
asdasd
|
asdasd
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user