[lug] Source Code Pretty-fying
lists at morris-clan.net
Tue Sep 14 22:39:26 MDT 2004
On Tue, Sep 14, 2004 at 09:58:58PM +0000, D. Stimits wrote:
> >adopted a 4-spaces-per-tab-character standard. You can set tab widths
> >in vi, but I don't recall exactly how....
> :set tabstop=4
Note that if you're using VIM (not certain if it works with
plain vi) you can add a line in a file to specify its
options. For example:
/* vim:et:ts=4:tw=75 */
That will set "exapand tabs", Tab Stop to 4, Text Width to
75 Characters. Any VIM option can be set that way. For
VIM v 6.x specific options such as folding, you can use
"vim6:..." insetad of "vim:..." to ensure you don't get
errors from older versions. This mode line can be either at
the top or bottom of the file.
I include such mode lines in *all* text files I write
(especially at work!) so I don't have to worry about how VIM
is configured on the machine/account where the file is being
> PS: I'm a fan of real tabs because of ability of smarter editors
> customizing width for individuals.
I used to think this way too, but I've found that when
several developers work on a single file spaces are
necessary. All you need is one person who likes an editor
which always uses spaces to royally mess things up.
Especially when working with a language like Python where
indentation matters a lot, this can create some real
Its also been my experience that if you tell a group of
people to use spaces instead of tabs, they usually will.
Yet if you tell them to use tabs and not spaces, some will
invariably use spaces anyways, though usually just because
their favorite editor expands tabs by default.
More information about the LUG