DetectIndent : Automatically detect indent (expandtab, shiftwidth, tabstop) settings
| script karma
Downloaded by 1664
Comments, bugs, improvements
script versions (upload new version)
|This script provides a command which will attempt to guess the correct indent settings for an open file, for use when there is no modeline available. Note that this is a pure vim implementation, and doesn't require any external applications or interpreters.
May also be used in an autocommand, for example:
:autocmd BufReadPost * :DetectIndent
To prefer 'expandtab' to 'noexpandtab' when no detection is possible:
:let g:detectindent_preferred_expandtab = 1
To specify a preferred indent level when no detection is possible:
:let g:detectindent_preferred_indent = 4
Detection is by no means perfect. It won't work if files use especially perverse combinations of spaces and tabs, or weird tab widths. Bug reports and patches encouraged...
Keeping things up to date on vim.org is a nuisance. For the latest version, visit:
|Place in ~/.vim/plugin/ and ~/.vim/doc/|
Click on the package to download.
ip used for rating: 126.96.36.199