[Gllug] vi indenting

Nix nix at esperi.demon.co.uk
Thu Dec 20 23:25:53 UTC 2001


On Wed, 19 Dec 2001, tet at accucard.com moaned:
>>Do you have any idea how annoying that is when a file is indented by
>>people with their tabstop set to different values?
> 
> Probably almost as annoying as it is when a file is indented with
> differing numbers of spaces, I'd imagine. For natural language
> texts, then sure, indent with spaces, but I've yet to see a single
> valid argument (including jwz's) for indenting code with anything
> but tabs. Maybe when you've had to work on code that's indented
> with a mix of 2, 3, 4 and 5 spaces in the same file, you'd agree.

Maybe when you've had to work on code that's indented by people with
tabstop= set to 2, 3, 4, 8 and 10, using mixtures of spaces and tabs to
line up some constructs (like switch statements), you'd realise what's
wrong with a character which expands to an *unknown* number of spaces
and affects the look of the code in unknown ways.

Tabs are nearly as bad for the readability of code edited by multiple
people as trigraphs.

--- oh, and btw, your argument does not rebut jwz's, but supports
it! (A tad ironic, that.)

> I have, all by different authors, of course, and it wasn't a pleasant
> experience.

Quite so :( but it's easy to fix that -- indent, and a coding
standard. The problem with a coding standard that says `thou shalt
indent with tabs' is that it's basically impossible to spot if people
have been violating it in code reviews, because tabs look just like
collections of spaces when printed out.

>>traditional vi's habit, in optimize mode, of converting single spaces
>>in the middle of a line into tabs doesn't help here
> 
> Hmmm. In 14 years of using vi, I've yet to provoke it to do this. But
> then, I can't recall ever meeting a vi that had optimize set by default,

Every vi in a commercial Unix I've ever used had it on by default :(

> and I can't think why anyone would want to explicitly enable it, either.

Because they are *desperately* short of disk space?

--- OK, these days, it would only be because they were insane.

-- 
`Mmm... Maybe I just like strong women that can hurt me?'
     --- Vadik, on female throat-cutting doctors

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list