DetectIndent : Automatically detect indent (expandtab, shiftwidth, tabstop) settings
script karma |
Rating 41/16,
Downloaded by 495 |
created by |
Ciaran McCreesh |
|
script type |
utility |
|
description |
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.
Usage:
:DetectIndent
May also be used in an autocommand, for example:
:autocmd BufReadPost * :DetectIndent
Options:
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
Notes:
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... |
|
install details |
Place in ~/.vim/plugin/ and ~/.vim/doc/ |
|
script versions (upload new version)
Click on the package to download.
|