Tip: #1124 - Turn off per-filetype auto indentation
Created: February 9, 2006 12:16 Complexity: basic Author: Alvin Version: 6.0 Karma: 15/10 Imported from: Tip#1124
That's quite hard to find how to really turn off all auto indentation.
I tried to place "set noai" in vimrc, but the auto-filetype-detecting feature will override "set noai" if your file has for instance ".cpp" or ".java" common extension.
I�ve checked in fact the default setting of vim is �noai�, therefore we don�t need �set noai�.
My solution is placing these in wimrc: "filetype plugin indent off" and "filetype indent off".
Comments
sorry for the typo: not wimrc but vimrc
Anonymous , February 9, 2006 12:58
Just don't put "filetype indent plugin on" in your .vimrc and you don't need to put "filetype indent plugin off" there. Autoindentation is off by default AFAIK.
Anonymous , February 9, 2006 21:06
I was using the excellent XMLFolding.vim script, editing xml, plus the matchit.vim script, so I can use % to visit tag boundaries... but I didn't like the automatic indent. I found that this turned it off for me while editing and xml file.
- set indentexpr=
However-- Now I'm finding that it may be better to leave it on!
P.S. - I could not find a way to report this, but the XMLFolding.vim script seems to be fantastic for vim 6.2, but I cannot get it to work for vim 6.3 as of March 2, 2006.
rvp3--AT--optonline.net , March 2, 2006 10:22
Rationale for deleting this tip:
- filetype plugin and filetype indent are off by default (unfortunately), as noted above
- they are both recommended settings, which can improve a lot indenting and editing in general of files with such a filetype
- if an indent file for a particular filetype is not wanted, it can be overridden by a custom ftplugin (see :help after). All the methods presented in this tip are dirty hacks...
Ipkiss 22:05, 23 July 2007 (UTC)
Hmm, this seems to be a problem for some ppl, and I guess :help after is the right answer. I would keep it. bastl 09:02, 26 July 2007 (UTC)