On Dec 23, 10:01 pm, Tony Mechelynck <[email protected]>
wrote:
> On 23/12/08 15:49, Brett Stahlman wrote:
>
>
>
>
>
>
>
> > On Dec 22, 7:41 pm, pansz<[email protected]> wrote:
> >> Brett Stahlman 写道:
>
> >>> If you use tabs only for leading indent, an indent level can
> >>> be whatever you want it to be when you're viewing the file. Almost as
> >>> importantly, it can be whatever someone else wants it to be when he's
> >>> viewing the same file...
> >> No, this is a false illusion, you cannot expect a non-constant indent
> >> level anyway, consider the following code.
>
> >> suppose we have 4 space as indent level:
> >> {
> >> foobar1(); // comment1
> >> if (fb2()) { // comment2
> >> fb3(); // comment3
> >> switch (x) { // comment4
> >> case 1:
> >> fb4(); // comment5
> >> break;
> >> default: // comment6
> >> break;
>
> >> }
> >> }
> >> }
>
> >> now we change the indent level to 3:
>
> >> {
> >> foobar1(); // comment1
> >> if (fb2()) { // comment2
> >> fb3(); // comment3
> >> switch (x) { // comment4
> >> case 1:
> >> fb4(); // comment5
> >> break;
> >> default: // comment6
> >> break;
>
> >> }
> >> }
> >> }
>
> >> Got the idea? If anyone wants to change the indent level, the code is
> >> ruined anyway.
> > No. I didn't say use only tabs. I said "use tabs only ***for leading
> > indent***". The distinction is very important. To align end of line
> > comments within a block, you use spaces. Not only does using space for
> > leading indent waste an excessive amount of space in source files with
> > relatively short lines and high levels of indent, it also forces
> > everyone viewing the file to use the indent level preferred by the
> > original author.
> > Brett Stahlman
> >> Simply use only space for indent solves all problem above, personally I
> >> do recommend not to use tab size other than 8 at all.
>
> Yes, and Shizu wrote that as soon as there are statements (such as an
> "if") with varying levels of indent within your block, your comments
> will move when you change the 'tabstop' setting.
What do you mean "the comments will move"? Comments within a single
block will not be affected at all by the change of tabstop, as the
tabstop change affects all lines within the block equally. Of course,
comments from different blocks will not be aligned, but you shouldn't
expect them to be. Consider that with the style you recommend below
(ts=8 and sts=4), you will have much worse problems than comments from
different blocks not aligning...
Brett S.
>
> Like him, I recommend leaving 'tabstop' at 8. If you want other levels
> of indent, you may for instance ":set sts=4 sw=4". And in some files
> that may be exported to systems (such as email) where tab stop settings
> are uncertain, I use 'expandtab' to replace my tabs by spaces as I type
> them.
>
> Best regards,
> Tony.
> --
> Burn's Hog Weighing Method:
> (1) Get a perfectly symmetrical plank and balance it across a
> sawhorse.
> (2) Put the hog on one end of the plank.
> (3) Pile rocks on the other end until the plank is again
> perfectly balanced.
> (4) Carefully guess the weight of the rocks.
> -- Robert Burns- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---