How can I prevent PerlTidy from aligning my assignments?
Asked Answered
I

1

6

By default, PerlTidy will line up assignments in my code. E.g.

PerlTidy changes this...

my $red = 1;
my $green = 2;
my $yellow = 3;
my $cyan = 4;

...into this...

my $red    = 1;
my $green  = 2;
my $yellow = 3;
my $cyan   = 4;

How do I prevent this from happening? I've trawled the manual but I can't find a solution.

Thanks!

Infanticide answered 17/6, 2010 at 13:9 Comment(1)
E
9

See the discussion of the -aws option (--add-whitespace). By default -aws is enabled. You can alter this behavior using -naws (deleting whitespace is OK, but don't add) or -fws (don't add or delete whitespace). Details here.

Encephalon answered 17/6, 2010 at 13:53 Comment(2)
Thanks FM. -naws does roughly what I want. It won't un-align assignments that are already aligned, but such is life :)Infanticide
Is it possible to keep addition of single spaces? I have just asked such a question here: #4538709Informant

© 2022 - 2024 — McMap. All rights reserved.