Re: VIM config in PEAR files?
| From: | Brent Cook | Date: | Tue, 16 Apr 2002 13:36:28 +0000 |
| Subject: | Re: VIM config in PEAR files? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5562@lists.php.net to get a copy of this message | ||
> printf("%s",
> $arg);
> ^^^^^^^
> This is 7 spaces. That's one 4-space tab and 3 spaces. If displayed in
> some editor that has 8-space tabs by default, it will look like this:
So, why not just use 7 spaces for that case? Tabs are not for formatting,
but for indenting. If you wanted to indent this code, do this:
printf("%s",
^^^^^^^$arg);
> print("%s",
> $arg);
>
> Ditto with tabbed code written in an 8-space-tab editor viewed with
> 4-space tabs:
>
>
> if (foo &&
> bar) {
> }
>
> Will look like this:
>
> if (foo &&
> bar) {
> }
It's the same straw argument. That is no reason to ban tabs entirely, just
a reason to not use tabs incorrectly. Both of these examples illustrate a
common mistake when using tabs that they are used to align text to other
text. This is not true. Tabs are only useful for indenting blocks of code
that are only aligned to the same block. Using tabs to align to characters
in a previous line is silly.
> In an environment like PEAR where people use lots of different editors,
> using tabs simply doesn't work. People will end up doing whitespace
> commits fixing rendering in their editor, while breaking it for others.
> Without tabs it will look the same to everyone.
It doesn't work when people do not follow consistent conventions. That is
something to be contested.
> Diff and less are tools that programmers use, so that argument is just
> bogus.
Aren't we discussing this for the sake of programmers?
Anyway, less has a configurable tab-widths and diff has options to
work-around your problem.
From less's man page:
-xn or --tabs=n
Sets tab stops every n positions. The default for
n is 8.
From diff's man page:
--expand-tabs
Expand tabs to spaces in the output, to preserve
the alignment of tabs in the input files.
--initial-tab
Output a tab rather than a space before the text of
a line in normal or context format. This causes
the alignment of tabs in the line to look normal.
- Brent