timakro / vim-yadi

Yet Another Detect Indent
MIT License
15 stars 3 forks source link

add minimal line count #7

Closed Konfekt closed 6 months ago

Konfekt commented 6 months ago

addresses #6

timakro commented 6 months ago

I don't think this is a good idea. When there is a single indented line in a file it's more likely than not the true indentation level of the file. Sure, there can be outliers, but without being more clever the best thing we can do is assume the most likely scenario which is that the indentation we see is the true indentation.

Konfekt commented 6 months ago

When there are only one or two indented lines, it is rather unlikely that an indent of 5 or 7, say, was indented by the user, but rather accidental. Therefore, only accept common values to keep out of the way.

timakro commented 6 months ago

This gives me the following idea: if there are only one or two indented lines, only accept common indents like 2, 4 (maybe 8). This would solve both #4 and #6. What do you think?

Konfekt commented 6 months ago

Yes, I agree. The two line limit is arbitrary, of course. Still, indent increases > 8 should be disregarded as well, as your example in #5 shows.

timakro commented 6 months ago

Merged! I don't think disregarding indentations > 8 is necessary as this already covers the example in #5.