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

Re: OT: vim syntax highlight on C program files only?



On Tue, Sep 25, 2001 at 03:36:14AM -0500, will trillich wrote:
> On Tue, Aug 28, 2001 at 01:18:43PM -0700, Karsten M. Self wrote:
> > Is there a setting which allows a tab to indent by 4 chars, but leaves
> > tabstops at 8 chars, where most apps seem to expect to find them?

'set softtabstop=4'

> probably (sts and ts, i'd say) but just so we're clear, anyone
> found recommending the MIXTURE of spaces AND tabs for
> indentation should be shot in the head.
> 
> wanna indent two spaces at a time? fine -- use two spaces, then
> four, six, eight, ten... never two, four, six, tab, tab+2...

I agree [1], except for one nice indenting strategy I've seen. Sometimes
you want to distinguish between indentation used for blocks and
indentation used for lining things up. I don't mind whether people use
spaces or tabs for blocks, but for lining things up it should always be
spaces.

For example (tabs here may be clobbered in transit, though):

	if (function_call ((my_variable + other_variable) *
	                   yet_another_variable)) {
		foo ();
	}

Before 'yet_another_variable' comes one tab followed by a load of
spaces. All other lines begin with tabs. That way, no matter what your
tabstop settings are, the various bits of the if will always be lined up
correctly.

Not that I actually have the discipline to practice what I preach all
the time, of course.

[1] Wow, I agreed with Will about something involving tabs!

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: