Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: The One True Style of indentation:

by snafu (Chaplain)
on Apr 15, 2002 at 14:38 UTC ( [id://159210]=note: print w/replies, xml ) Need Help??


in reply to The One True Style of indentation:

In vim:

set sw=4 set expandtab
An excellent solution for tab-to-4 spaces without the actual \t. I luuuub vim

Update:
tab'ing is fine only if:

  • 1. Your editor replaces your \t with spaces so that your code has readability in more than one editor. Ever tried reading your code in vim after writing it in vi?
  • 2. You don't tab out to 8 spaces! That is just ludricous. Editor line wrapping is retarted looking. So, if you have code that spans out over more than 4 or 5 tabs you either have to do something like:

    code { code{ code { code { code { # Lots of tabs out to here... +must be taking a lot of space so far so you use the cat operator to k +eep from line wrapping but hey...this comment is really long and man, + I just hate line wrapping. my $line = "this is a". "line that won't". "line wrap.\n"; } } } } }
    But this kind of thing is just crazy when it can easily be avoided by simply not taking up so much space with tabstops (generally set at 8). You get just as much readability out of 4, 3 or sometimes even 2 space tabs (Im using the term 'tab' loosely here). But, I guess its all persona, therefore, Im just saying that, imo, tabs so large are just ridiculous and the use of 'tab' as a real tab is not wide or respectful to the maintainers of your code after you're done.

    I mean really! Is the following code any less readable than the above?

    code { code{ code { code { code { # and of course, I would fix my # comment too. my $line = "this is a line that won't". " line wrap.\n"; } } } } }

    _ _ _ _ _ _ _ _ _ _
    - Jim
    Insert clever comment here...

  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Node Status?
    node history
    Node Type: note [id://159210]
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others wandering the Monastery: (5)
    As of 2024-04-18 20:22 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found