Làm thế nào tôi có thể cấu hình perltidy để định dạng lâu nếu phát biểu như thế này:perltidy định dạng phức tạp nếu
if (
('this is an example' =~ /an.*example/ and 1 * 2 * 3 == 6) or
('hello world' =~ /world/ and 6 = 3 * 2 * 1)
) {
print "hello\n";
}
hoặc như
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 này: 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
Chỉnh sửa2: Ý tưởng là có một dòng mới sau (
đầu tiên và cũng là dòng )
mới nhất để có một dòng mới với {
. Nếu điều này là không thể, bất kỳ đề xuất nào khác để định dạng tốt hơn sẽ được đánh giá cao.
Có cách nào để thêm dấu cách trước/sau dấu ngoặc ngoài nếu câu lệnh là đa dòng không? (p.s. Tôi đã thêm perltidyrc của tôi trong đó tôi loại bỏ chúng) – bliof
@ bliof, không, các tùy chọn cho các khối tạo kiểu tóc là khá hạn chế. – titanofold