Tuesday, April 27, 2010

Re: How to fix broken automatic indentation in vim

On Apr 27, 11:29 am, Didlybom <didly...@gmail.com> wrote:
> I have tried using different combinations of the autoindent, smartindent and
> cindent settings. After going through these forums I have also made sure
> that the "syntax", "filetype", "filetype indent" and "filetype plugin
> indent" are set to on. Still, it does not work. Also, if I do "set syntax?"
> I get "matlab" for matlab files and "vhdl" for vhdl files which is correct.
> And if I do "set indentexpr?" I get "GetMatlabIndent(v:lnum)" for matlab
> files and "GetVHDLindent()" for vhdl files.
>

I know filetype indent plugins *should* override these options, but in
general you should NOT set cindent in your .vimrc, you should rely on
the filetype indent rules to set it for you. You should also not have
smartindent on in combination with any other indent option. I would
say you should not have smartindent on at all...but I know there are a
few people who actually prefer the behavior of this option.
Regardless, it's supposed to work *instead* of, not in addition to,
filetype indent rules.

Your indentexpr values indicate the correct rules are being applied,
but make sure cindent, smartindent, and possibly even autoindent are
all turned off as well. Also check that 'equalprg' is empty.

Other than that, it may be an error in your indent scripts (though
this is unlikely). Are your runtime files fairly recent?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en

No comments:

Post a Comment