# LaTeX indentation in vim

Does there exist a good option/plugin for ? I tried different combinations of autoindent, smartindent and cindent, what I get is:

\begin{tabular}{ c }
foo \\
bar
\end{tabular}


but what I'd like to have is (or something similar, my requirements on are not that strict):

\begin{tabular}{ c }
foo \\
bar
\end{tabular}


I also tried setting

let g:tex_flavor='latex'


but with no avail.

• You can use a combination of snippets (containing the indentation) and autoindent (to continue the indentation on new lines). – Marco Jan 26 '14 at 22:48
• Have a look at latexindent (disclaimer: I'm the author). Here's a youtube demonstration- documentation is on ctan, and it is part of texlive – cmhughes Jan 26 '14 at 23:38