aboutsummaryrefslogtreecommitdiff
path: root/doc/detect_indent.txt
blob: 7ba0fa8784e029ffa2b6581ea6838b5318a8b94f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
*detect_indent.txt*	For Vim version 7.0	Last change: 2020 May 30

DESCRIPTION				*detect_indent*

This plugin provides a user command to be run on a buffer after filetype
detection, applying some simple heuristics to adjust indentation settings if
the user's settings don't appear to match the buffer's settings.  It pivots on
the value of 'expandtab'.

If changing from 'noexpandtab' to 'expandtab', a guess at an appropriate value
for 'shiftround' is attempted.  It may not be accurate.

REQUIREMENTS				*detect_indent-requirements*

This plugin is only available if 'compatible' is not set.  It also requires
the |+user_commands| feature.

COMMANDS				*detect_indent-commands*

					*:DetectIndent*
Run the plugin's detection manually if needed.  You will probably only want to
do this for debugging purposes, as the command should be run after |FileType|
hooks.

OPTIONS					*detect_indent-options*

					*g:detect_indent_limit*
Set `g:detect_indent_limit` to the upper limit on the number of lines checked
to detect the indent.  The default value is 1024.

					*g:detect_indent_confidence*
Set `g:detect_indent_confidence` to the minimum percentage of space indent
levels of the total indented lines sufficient to adopt that value for
'shiftround'.  If almost all of a thousand-line file is indented by multiples
of 4 spaces, for example, but there is a single line with 3 spaces by
accident, this threshold should ignore such an outlier.  The default is
5 (percent).

AUTHOR					*detect_indent-author*

Written and maintained by Tom Ryder <tom@sanctum.geek.nz>, who has friends who
use tabs where he doesn't, and vice-versa.

LICENSE					*detect_indent-license*

Licensed for distribution under the same terms as Vim itself (see |license|).

 vim:tw=78:ts=8:ft=help:norl: