phpStylist
PHP_Beautifierには見切りをつける。
- ラッパー
#!/bin/sh php=`which php` stylist="/path/to/phpStylist.php" $php $stylist "$@" \ --indent_size 4 \ --line_before_comment_multi \ --keep_redundant_lines \ --space_inside_parentheses \ --space_after_comma \ --space_around_assignment \ --align_var_assignment \ --space_around_comparison \ --space_around_arithmetic \ --space_around_logical \ --space_around_colon_question \ --line_before_function \ --space_after_if \ --add_missing_braces \ --space_inside_for \ --indent_case \ --line_after_break \ --vertical_array \ --align_array_assignment \ --space_around_double_arrow \ --vertical_concat \ --space_around_concat \ --line_before_comment_multi
- vimから呼ぶ
command! -bar -narg=0 Tidy call <SID>Tidy() nnoremap <silent> <leader>ti :call <SID>Tidy( )<cr> function! s:Tidy( ) let cmd = '' if &syntax == 'php' let cmd = 'path/to/ラッパー %' endif if cmd == '' return endif execute ':%:!' . cmd endf