1

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 :(

Jo Mo
  • 113
  • 4

1 Answers1

4

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

Glad you like it! :)

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.

Karl Yngve Lervåg
  • 9,494
  • 25
  • 35
  • 1
    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. – Jo Mo Jan 27 '22 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 :) – Karl Yngve Lervåg Jan 28 '22 at 17:27