Re: VIM config in PEAR files?
| From: | Stig S. Bakken | Date: | Tue, 16 Apr 2002 21:20:19 +0000 |
| Subject: | Re: VIM config in PEAR files? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5584@lists.php.net to get a copy of this message | ||
On Tue, 2002-04-16 at 15:36, Brent Cook wrote:
> > 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);
Most editors auto-indent. It is completely unreasonable to expect from
people that they should hand-fiddle spaces and tabs like you suggest.
> > 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.
Likewise, the point is not what you type, but what your editor does and
how you configure it.
> > 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?
Yes? Don't programmers do "cvs diff | less"?
> 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.
I know that, but that only helps me, not everyone else.
- Stig