Wie kann ich konfigurieren perltidy lange formatiert werden, wenn Aussagen wie folgt aus:perltidy Formatierung komplex, wenn
if (
('this is an example' =~ /an.*example/ and 1 * 2 * 3 == 6) or
('hello world' =~ /world/ and 6 = 3 * 2 * 1)
) {
print "hello\n";
}
oder ähnliche
if (
('this is an example' =~ /an.*example/ and 1 * 2 * 3 == 6)
or ('hello world' =~ /world/ and 6 == 3 * 2 * 1)
) {
print "hello\n";
}
Edit1: perltidyrc
--maximum-line-length=100
--indent-columns=4
--default-tabsize=4
--continuation-indentation=4
--closing-token-indentation=0
--no-indent-closing-brace
--paren-tightness=2
--square-bracket-tightness=2
--block-brace-tightness=0
--trim-qw
--nospace-terminal-semicolon
--nospace-for-semicolon
--indent-spaced-block-comments
--ignore-side-comment-lengths
--cuddled-else
--no-opening-brace-on-new-line
--no-opening-sub-brace-on-new-line
--no-opening-anonymous-sub-brace-on-new-line
--no-brace-left-and-indent
--blanks-before-comments
--blank-lines-before-subs=1
--blanks-before-blocks
--maximum-consecutive-blank-lines=1
Edit2: Die Idee ist es, eine neue Zeile nach der ersten (
und auch die letzte )
auf eine neue Zeile mit {
zu haben. Wenn dies nicht möglich ist, werden weitere Vorschläge zur besseren Formatierung berücksichtigt.
Gibt es eine Möglichkeit, Leerzeichen vor/hinter den äußeren Klammern einzufügen, wenn die Anweisung mehrzeilig ist? (p.s. Ich habe meine perltidyrc hinzugefügt, in denen ich sie entfernen) – bliof
@bliof, nein, die Optionen für die Gestaltung von Blöcken sind ziemlich begrenzt. – titanofold