Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I start with the following in a LaTeX document:

    u(x, t) &= \frac a2 \int_0^t \dif s \int_{x-a(t-s)}^{x+a(t-s)} \dif y \sin(\omega y) \\

Then I go on and enter the second line, Vim aligns the &, which is sort of neat. It all goes well just before the first }:

    u(x, t) &= \frac a2 \int_0^t \dif s \int_{x-a(t-s)}^{x+a(t-s)} \dif y \sin(\omega y) \\
            &= \frac{1

Then I enter the } and it does this:

    u(x, t) &= \frac a2 \int_0^t \dif s \int_{x-a(t-s)}^{x+a(t-s)} \dif y \sin(\omega y) \\
                  &= \frac{1}

With every }, it gets indented a little more. After a while, the whole align* is completely unreadable.

How can I make Vim stop doing this?

My complete .vimrc

share|improve this question
I have similar issues with html files, would be nice to know how to deal with this. You can try :set noautoindent in the meantime – Ярослав Рахматуллин Oct 27 '12 at 18:03
I use filetype indent, that should do HTML correctly. – Martin Ueding Oct 27 '12 at 18:26

2 Answers 2

up vote 5 down vote accepted

I had the same problem. gvim ignored my noautoindent settings in my .vimrc. I checked the settings in a .tex file with :verbose set ai? and it revealed that autoindent was enabled through the vim-latex plugin. To disable indentation after braces put the following code in your .vimrc (or .vim/after/ftplugin/tex.vim):

let g:tex_indent_brace=0

If you do NOT use vim-latex, try to find out which script is causing the indentation.

share|improve this answer
This seems to have fixed it. It was set to 1. – Martin Ueding Nov 25 '12 at 20:57

I solved the problem via :set expandtab (the workaround of panos did not work for me). It seems, that the vim plugin get confused, when you have tabs and spaces mixed in the file. So I set in my .vimrc:

autocmd Filetype tex setlocal expandtab

See for details about tabs and spaces in vim.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.