ciaranm/detectindent — pull request #15 by ogier (2012-10-01 05:27:50+00:00)
Title: Make the indentation guessing much less invasive.

In my experience this plugin gets the indentation wrong too often
to be useful in its current state, and it adjusts different settings
depending on what it finds. So I modified it to only ever adjust
shiftwidth, softtabstop and of course expandtab, and only when it
can make a reasonable guess about what's going on.

I'm not sure whether this is an appropriate pull request to actually be
merged in upstream, because it does change behavior in some noticeable
ways. In any case, here it is, and here's what I changed:

1. Never set tabstop: just let the default from vimrc take priority.
The only interesting case is when leading tabs and spaces are
mixed, and in my experience the only sane guess in that situation
is "4". This change removes the need for
g:detectindent_preferred_indent

2. Count how many times we see leading tabs vs. leading spaces, so
that we can make a better guess about what the file is using.
This change makes g:detectindent_preferred_expandtab just a
hint as to which setting to lean towards when guessing.

3. If we don't see any leading tabs or spaces, don't do anything.
Users can set filetype defaults easily for this kind of
situation anyways.