Improve space-based shiftwidth detection #16

Open
wants to merge 6 commits into
from

Projects

None yet

2 participants

@aclindsa
aclindsa commented Dec 5, 2012

I've modified your detectindent script slightly to change how the number of spaces per tab is detected. It seems to have improved the detection a little, and figured I'd let you know in case you wanted to incorporate any of my changes back into your tree.

Thanks!

czchen and others added some commits Oct 11, 2012
@czchen czchen Count leading tab and space eb51238
@czchen czchen Use leading tab & space count to determine indent style a0e20a6
@aclindsa aclindsa Add .h files to C-style comment detection c2ff549
@aclindsa aclindsa Make leading_space_count a local variable fd89a72
@aclindsa aclindsa Set shiftwidth based on the GCD of the most common tab spacings.
The previous method of using the shortest existing tab spacing worked
some of the time, but isn't as robust as the GCD method (i.e. if there
was one or two lines that started with only one space, but the rest of
the lines started with four spaces, the old method would set shiftwidth
to 1).
8924eaa
@aclindsa aclindsa Bail out if we detect a version of vim < 7 736b001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment