[Tutor] tabs or spaces (the endless debate!)

Paul Tremblay phthenry@earthlink.net
Sat Feb 15 12:05:03 2003


Sorry if this question causes an endless debate--as I have seen it do on
the vim mailing list. 

I want to know if I should use tabs or spaces when indenting.

I use vim, and have been using the autoindent feature. If I type

if var==5:

then vim atomatically inserts a tab of 8 spaces for the next line:

if var==5:
	pass #do something

However, 8 spaces is quite a bit of space. To improve the excessive
space problem, I told vim to change the amount of space in a tab from 8
to 5. 

I then ran a script and found I got a strange out of index message which
I had already checked for. It turns out that vim had screwed up the
indenting so that what had been part of an 'if' statment was no longer
part of it. 

Because of this, I am suddenly inclined towards spaces. I plan to
distribue my module, and I see that tabs could cause the whole thing to
break.

So can someone sum up the pros and cons of tabs versus spaces?

Also, if I do decide on spaces, how do I make vim automatically insert 5
spaces, rather than a tab space of 8. (I know this is really a vim
question, but I figure that there are bound to be some vim users who
know this question cold.)

Thanks

Paul



-- 

************************
*Paul Tremblay         *
*phthenry@earthlink.net*
************************