Vim Tips Wiki
Advertisement

Previous TipNext Tip

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

filetype plugin indent off
filetype indent off"

Comments

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


  • 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 and :help after-directory). All the methods presented in this tip are dirty hacks...

Ipkiss 22:05, 23 July 2007 (UTC)


Advertisement