In TeX vim usually screws up my indentation. Mainly when I'm in a displayed equation which I think should look like this:
\[
x=\frac{y}{z}
\]
where the whitespace infront of the x
is one tab.
When I start type the equation I type the \[
and \]
marks first and then go back between them, typing the tab and then the rest of the equation.
Vim doesn't do anything wrong until I have to use something that incorporates curly braces (\frac{}
for example). When I type the closing }
vim automatically shifts the indentation for the whole line to the left, which undoes my typed tab.
This is very anoying, how do I disable it?
my .vimrc
contains:
"indentation
set smartindent
set autoindent
set tabstop=5
set shiftwidth=5
filetype indent on
There seem to be a little mix of terms in your question. In vim the term autoindent points to a special kind of indentation that simply follows the indent level of the previous line (which is quite handy sometimes). To remove it set noautoindent
by hand, or write it in your _vimrc.
There are two other automatic kinds of indentation, cindent
and smartindent
. Similarly, if you wish to disable them go with set nocindent
and set nosmartindent
If you look in help (help autoindent
, ...) they are all quite nicely explained. Which one you prefer (or don't) is mostly determined by your programming style and habits. So, try them out and see which you like most.
Unfortunatelly, I don't use LaTeX that much anymore, so I'm not familiar with its internal filetype indentation rules.