Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Consistent tab width settings

by atcroft (Abbot)
on Sep 10, 2022 at 23:06 UTC ( [id://11146821]=note: print w/replies, xml ) Need Help??


in reply to Consistent tab width settings

As editors (and, apparently, browsers) can represent tabs differently, the best advice is probably to use spaces instead of tabs in your code (and many editors can do this conversion for you). Running a snippet through perltidy (as previously recommended) is probably also a very good idea.

Personally, I try to use 4-spaces for most code ('perltidy -l 123 -ple' unless I am trying to match someone else's formatting, or have another limitation), but I may have used 2-spaces for some code examples, and I try to avoid the question of how many spaces is "best" (as that argument is almost as long and as bad as those of editor choice).

Just my thoughts...

Replies are listed 'Best First'.
Re^2: Consistent tab width settings
by LanX (Saint) on Sep 10, 2022 at 23:47 UTC
    Again: Not the question.

    It's very easy: some ppl use tabs and the editing looks different to the final display.

    Making that consistent° will spare us from seeing some ugly code.

    off topic

    If you want to forbid tabs altogether, you or others are free to implement² an untabify feature like in emacs and many other IDEs.

    But that's another discussion and step. And it won't make misformatted code better readable. Especially as long as the input textarea looks different to the final rendering (sic).

    Regarding perltiy: I'm looking forward to see the patch³ to integrate this here.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    °) should be easy

    ²) not that easy, but feasable

    ³) LOL

        I would anchor it to line start only, maybe with the exemption of leading #

        ... to assure only indentation is replaced.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found