Tab stops (Re: [prog] C and curly braces - question of style?)
Sue Stones
suzo at spin.net.au
Wed Aug 25 01:20:35 EST 2004
On Tuesday 24 August 2004 07:35, Terri Oda wrote:
> On Aug 23, 2004, at 5:03 PM, Jimen Ching wrote:
> > '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!)
You can save even one more keystroke by useing "se" as a shorthand for "set"
"se ts=2"
I often change my tabstops on teh fly with my own code let alone someone
elses. I start of with 8, then drop to 4 when I have a lot of indenting, if
necessary drop to 2.
>
> 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.
I mentioned this but perhas someone else did too. I think vi uses tabs for
autoindent, and since I use tabs I haven't had this troble with vi, its other
editors that mix them up.
> 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. :)
3 is a common indent level in windows editors that I have used. I eventually
got used to it, but stick to 2,4 or 8 when I have a choice. I think this is
because they are binary numbers, though how much of this is a psychological
conncetion and howmuch is actually easier for the computer to handle I don't
know.
I haven't noticed 5, 6 or 7 being used.
sue
More information about the Programming
mailing list