| | 4 | == [http://perltidy.sourceforge.net/ Perltidy] == |
| | 5 | * Perl の Pretty Printer |
| | 6 | |
| | 7 | === 設定 === |
| | 8 | * by Perl Best Practices |
| | 9 | {{{ |
| | 10 | $ cat ~/.perltidyrc |
| | 11 | -l=78 # Max line width is 78 cols |
| | 12 | -i=4 # Indent level is 4 cols |
| | 13 | -ci=4 # Continuation indent is 4 cols |
| | 14 | -st # Output to STDOUT |
| | 15 | -se # Errors to STDERR |
| | 16 | -vt=2 # Maximal vertical tightness |
| | 17 | -cti=0 # No extra indentation for closing brackets |
| | 18 | -pt=1 # Medium parenthesis tightness |
| | 19 | -bt=1 # Medium brace tightness |
| | 20 | -sbt=1 # Medium square brace tightness |
| | 21 | -bbt=1 # Medium block brace tightness |
| | 22 | -nsfs # No space before semicolons |
| | 23 | -nolq # Don't outdent long quoted strings |
| | 24 | -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" |
| | 25 | # Break before all operators |
| | 26 | }}} |
| | 27 | |
| | 28 | === Emacs から使う === |
| | 29 | * from http://unknownplace.org/memo/2005/12/11#e001 |
| | 30 | {{{ |
| | 31 | ;;; perltidy-region |
| | 32 | (defun perltidy-region () |
| | 33 | "Run perltidy on the current region." |
| | 34 | (interactive) |
| | 35 | (save-excursion |
| | 36 | (shell-command-on-region (point) (mark) "perltidy -q" nil t))) |
| | 37 | (global-set-key "\C-ct" 'perltidy-region) |
| | 38 | }}} |
| | 39 | |