Tab stops (Re: [prog] C and curly braces - question of style?)

Terri Oda terri at zone12.com
Mon Aug 23 17:35:29 EST 2004


On Aug 23, 2004, at 5:03 PM, Jimen Ching wrote:
> On Mon, 23 Aug 2004, Amanda Babcock wrote:
>> On Mon, Aug 23, 2004 at 03:52:06PM +1000, Jenn Vesperman wrote:
>>> I prefer that people indent using tabs, not spaces. If you want a
>>> narrower tab level than is standard, set it in your editor.
>>
>> How does that work in vi?  (And I'm not necessarily assuming "it 
>> doesn't".
>> Vi ends up doing a lot of things that surprise me.)
>
> 'set tabstop=8' in command mode, or in .vimrc.

'set ts=8' also would work.  Saves a little extra typing for those who 
occasionally change the tab size on the fly for reading other people's 
code.  (I highly recommend doing this when working on stuff you didn't 
write.  It's very little work to make things seem so much more 
readable!)

As someone mentioned (I think it was Akkana?), though, you tend to end 
up with some combinations of tabs and spaces if you use 
auto-indentation, and vi is no exception to that rule/problem.  I wish 
it'd pick up the characters used in the previous line and just 
duplicate them, but I don't think it does.

This talk of tab stops reminds me of something I've wondered about... 
what are people's favourite tab sizes?  I set mine to 3 because I 
prefer to be able to fit a fair bit on screen, and when I used to use 2 
the indents didn't feel obvious enough.  But my best friend, when he 
noticed my setting, commented that he had never seen a tab stop set to 
an odd number before -- he's always used 4, 6, or 8.  I've seen 3, 4, 
5, 6 and 8.  No 7 for some reason.  But I still don't know what's most 
common for those who choose their tabs. :)

  Terri



More information about the Programming mailing list