sponsor Vim development Vim logo Vim Book Ad

Indent Detector : detect indent automatically

 script karma  Rating 8/5, Downloaded by 1261  Comments, bugs, improvements  Vim wiki

created by
luo chen
script type


- detect mixed indent(indent with both spaces and tabs) and echo warnning on `bufEnter` and `bufWrite` automatically.
- switch setting about indenting to fit the current indenting style automatically.
- detecting time is limited, so you don't need to worry about opening huge files.


- the options decided by this plugin are `expandtab` `smarttab` `tabstop` `shiftwidth` `softtabstop`, and is setted via `setlocal`.
- your own setting about indenting is also used as default when the indenting style is not decided. (when you create an empty file or enter a file which occurs no leading spaces or tabs)
- this plugin will do nothing when you open an readonly file (`:echo &readonly` to check that), so that you can open help files without warnning.

Go to [github](https://github.com/luochen1990/indent-detector.vim) for more details.
install details
### via Vundle:

Bundle 'luochen1990/indent-detector.vim'

### manually

put `indentdetector.vim` to directory `~/.vim/plugin` or `vimfiles/plugin`

> remenber to restart your vim after installation


rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
indentdetector.vim 0.0.2 2015-06-05 7.3 luo chen fillup: README_cn.md
fix: still set options when 'too many spaces here.'
fix: echom instead of echo to show warnning.
new: check on bufreadpost.
indentdetector.vim 0.0.1 2015-06-05 7.3 luo chen Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github