# vimtex: Avoid aligning in align environment in the document

So I'm using vimtex, and it's great, but there is one thing that is so annoying and I cannot believe that people actually use that feature. Namely, say I write something like

\begin{align}
x &= blabla
\end{align}


If I insert a latex-newline \\, then a newline and an alignment character &, vim does the following "for me", which really is totally contrary to all my hopes and dreams:

\begin{align}
x &= blabla \\
&
\end{align}


What I want is the far superior

\begin{align}
x &= blabla \\
&
\end{align}


Is there any way to achieve this?

There is an oldish thread on github, but the solutions given there don't seem to work anymore.

Surely I can't be the only experiencing this :(

• Hi and welcome! In the thread you linked, the g:vimtex_indent_align_on_ampersand option is mentioned. Have you tried that? Jan 27 at 17:33
• @Biggybi: Hi and thanks :) Yes, vim tells me that that variable does not exist :( Jan 27 at 17:36
• You just need to :let g:the_var = 0 before the plugin loads, probably. Jan 27 at 18:08

So I'm using vimtex, and it's great

but there is one thing that is so annoying ... What I want is the far superior

This is clearly opinionated! If it was objectively "far superior", then I would of course make it the default. But I personally prefer to align on the &s. I don't consider my preference superior and I don't find it surprising that people disagree with it. Which is why I made this optional. To disable, you can add the following line to your .vimrc (Vim) or init.vim (neovim):

let g:vimtex_indent_on_ampersands = 0


For more info and context, please see :help vimtex-indent and :help g:vimtex_indent_on_ampersands.

• Haha, I was of course only being half-serious/facetious. I wrote that while fairly frustraded with the issue. Thanks for your awesome plugin! It makes my texing so much faster, now I can spend my paper-writing time with fussing over not being able to compute things lmao. But in any case, it works now, I didn't know that you had to put it in the .vimrc, I assumed you could change the value during runtime. Jan 27 at 18:46
• No problem, and again I'm glad you did VimTeX useful! Feel free to open issues on GitHub if you have any problems :) Jan 28 at 17:27