History Report a problem
Article Edit this page Discussion

Turn off per-filetype auto indentation

From Vim Tips Wiki

(Redirected from VimTip1124)
Jump to: navigation, search

Tip 1124 Previous TipNext Tip

Created: February 9, 2006 Complexity: basic Author: Alvin Minimum version: 6.0 Karma: 15/10 Imported from: Tip#1124


It'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"

[edit] 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.


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!


  • 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...

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pushing Daisies
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Godzilla
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Turn off per-filetype auto indentation"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation


.