[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Tabs v.s. spaces



On Mon, Nov 17, 2003 at 07:57:46PM -0800, Joshua Kwan wrote:
> Hear, hear. Yes, 8-space indentation is a matter of pressing the Tab
> key, but it's a bit too big.. I've always stuck with two spaces.

So set your tabstop (and shiftwidth) in vi to 4, and you'll have four
character indents. Or 2. And if you save the tabs in the files (ie don't
use expandtab), then whoever else opens your code will get their
preference and everybody is happy.

> Note that if you want to quickly format your code with tab-character
> indentation (== 8 spaces), I like astyle -t <file>. Works like a charm.
> I've only tried it with C/C++ code so I don't know whether it works for
> other kinds of files.

VIM can do autoindenting for some languages too. Works OK with Perl,
and C, and badly with Tcl (but doesn't everything?).


Hamish
-- 
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>



Reply to: