vimtex/test/vader/indentation.vader
2016-12-17 12:13:21 +01:00

277 lines
5.0 KiB
Plaintext

Execute (Setup):
set shiftwidth=2
set expandtab
Given tex (Indent: regular tex):
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
{
asdasd
}
\end{document}
Do (Indent):
gg=G
Expect tex (Verify):
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
{
asdasd
}
\end{document}
Given tex (Indent: lists):
\begin{itemize}
\item item is indented twice
and the next line is indented to match
\end{itemize}
\begin{description}
\item[One] Ingeniería Electrónica ``first'';
a couple of lines.
\item[Doctorado] ``Generic title''
(Author): commentaries here
\end{description}
Do (Indent):
gg=G
Expect tex (Verify):
\begin{itemize}
\item item is indented twice
and the next line is indented to match
\end{itemize}
\begin{description}
\item[One] Ingeniería Electrónica ``first'';
a couple of lines.
\item[Doctorado] ``Generic title''
(Author): commentaries here
\end{description}
Given tex (Indent: math):
\[
1+1
\]
\begin{align}
2+2=4
\end{align}
\begin{equation}
\left(
f(x) = 3
\right)
\left.
f(x) = 3
\right.
\end{equation}
Test $[ ... )$ of unmatched brackets in
inline math text.
In R, there is the operator \verb|[<-|...
that ...
Do (Indent):
gg=G
Expect tex (Verify):
\[
1+1
\]
\begin{align}
2+2=4
\end{align}
\begin{equation}
\left(
f(x) = 3
\right)
\left.
f(x) = 3
\right.
\end{equation}
Test $[ ... )$ of unmatched brackets in
inline math text.
In R, there is the operator \verb|[<-|...
that ...
Given tex (Indent: tikz):
\tikz \fill[green] rectangle (0.5,0.5); Something
about something.
\begin{tikzpicture}
\draw [solid] let \p{I} = (0,0) in (1,1) -|
(\x{I}-1cm,-1cm) node [yshift=-.25cm] {(i)};
% Just some comment
\end{tikzpicture}
\begin{tikzpicture}
% (i) center contact head
\draw [solid] let \p{I} = (centerContactHead) in (centerContactHead) -|
(\x{I}-.75cm,-2.5)
node [yshift=-.25cm] {(i)};
% (ii) outer conductor of the contact head
\coordinate (outerContactHead) at (.8,-1.7);
\draw [solid] let \p{O} = (outerContactHead)
in (outerContactHead) -- (\x{O},-2.5)
node [yshift=-.25cm] {(ii)};
\begin{axis}
\addplot
table[row sep=crcr]{%
0 0\\
1 1\\
2 2\\
};
\end{axis}
\end{tikzpicture}
Do (Indent):
gg=G
Expect tex (Verify):
\tikz \fill[green] rectangle (0.5,0.5); Something
about something.
\begin{tikzpicture}
\draw [solid] let \p{I} = (0,0) in (1,1) -|
(\x{I}-1cm,-1cm) node [yshift=-.25cm] {(i)};
% Just some comment
\end{tikzpicture}
\begin{tikzpicture}
% (i) center contact head
\draw [solid] let \p{I} = (centerContactHead) in (centerContactHead) -|
(\x{I}-.75cm,-2.5)
node [yshift=-.25cm] {(i)};
% (ii) outer conductor of the contact head
\coordinate (outerContactHead) at (.8,-1.7);
\draw [solid] let \p{O} = (outerContactHead)
in (outerContactHead) -- (\x{O},-2.5)
node [yshift=-.25cm] {(ii)};
\begin{axis}
\addplot
table[row sep=crcr]{%
0 0\\
1 1\\
2 2\\
};
\end{axis}
\end{tikzpicture}
Given tex (Indent: verbatims):
\begin{verbatim}
#!/bin/bash
echo "test"
\end{verbatim}
\begin{lstlisting}
Indent
should
not affect verbatim environments!
\end{lstlisting}
Do (Indent):
gg=G
Expect tex (Verify):
\begin{verbatim}
#!/bin/bash
echo "test"
\end{verbatim}
\begin{lstlisting}
Indent
should
not affect verbatim environments!
\end{lstlisting}
Given tex (Indent: ampersands):
\begin{tabular}{cc}
\begin{tabular}{c}
Cell 1
\end{tabular} &
\begin{tabular}{c}
Cell 2
\end{tabular}
\end{tabular}
\begin{equation}
\begin{aligned}
1 &
& 2 \\
3 &
& 4 \\
\end{aligned}
\end{equation}
Do (Indent):
gg=G
Expect tex (Verify):
\begin{tabular}{cc}
\begin{tabular}{c}
Cell 1
\end{tabular} &
\begin{tabular}{c}
Cell 2
\end{tabular}
\end{tabular}
\begin{equation}
\begin{aligned}
1 &
& 2 \\
3 &
& 4 \\
\end{aligned}
\end{equation}
Given tex (Indent: ignored environments):
\documentclass{minimal}
\usepackage{amsmath}
\begin{document}
\begin{proof}
This statement is false.
\end{proof}
\end{document}
Execute (let g:vimtex_indent_ignored_envs = ...):
let g:vimtex_indent_ignored_envs = ['document', 'proof']
Do (Indent):
gg=G
Expect tex (Verify):
\documentclass{minimal}
\usepackage{amsmath}
\begin{document}
\begin{proof}
This statement is false.
\end{proof}
\end{document}
Given:
Execute (unlet g:vimtex_indent_ignored_envs):
unlet g:vimtex_indent_ignored_envs