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

Re: The One True Style of indentation:

by christina_sampson (Novice)
on Apr 14, 2002 at 19:57 UTC ( #158989=note: print w/ replies, xml ) Need Help??

in reply to The One True Style of indentation:

Wow. I probably shouldn't be saying this on my first day here, but here goes.
I can't believe how many of y'all said tab. I should probably just re-map one
of my meta keys to

s/\t/  /g;
two spaces!
christina (with love :) )

Comment on Re: The One True Style of indentation:
Download Code
Replies are listed 'Best First'.
Re: Re: The One True Style of indentation:
by japhy (Canon) on Apr 14, 2002 at 21:00 UTC
    Yes! Another believer! Oh, and here's a utility script of mine, detab:
    #!/usr/bin/perl -pi # can't use die() in BEGIN -- it looks funny :( BEGIN { $sp = shift or warn("usage: detab SP files...\n") and exit } s/^(\t+)/" " x ($sp * length $1)/eg;
    To cleanse your nasty tabbed files, simply run detab 2, and your leading tabs are replaced with 2 spaces per tab. The way japhy intended.

    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

      A slightly different way to do that:
      perl -pi -e 's/\G\t/ /g'
      (Adapted from a "replace-leading-zeros-with-spaces" oneliner I seem to remember)

      Update: looks like the original came from merlyn after dominus offered a suggestion similar to japhy's


        Ummm-- I think that was a 'dictum', not a suggestion...


        "Never try to teach a pig to sing…it wastes your time and it annoys the pig."

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2015-11-27 14:26 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (729 votes), past polls