以下の内容はhttps://masawada.hatenablog.jp/entry/2019/11/15/151627より取得しました。


Vim + aleで保存時にperltidyを実行してコードを整形する

aleはこちら。非同期でLinterを実行したり、autofixしたりといった作業をやってくれるいつものやつ。

github.com

$ cpanm Perl::Tidy

して Perl::Tidy をインストールしつつ、aleが入っている状態で .vimrc

let g:ale_fixers = { 'perl': ['perltidy'] }
let g:ale_fix_on_save = 1
let g:ale_perl_perltidy_options = '-pro=.../.perltidyrc'

すると完成します。

によると

A pathname begins with three dots, e.g. ".../.perltidyrc", indicates that the file should be searched for starting in the current directory and working upwards. This makes it easier to have multiple projects each with their own .perltidyrc in their root directories.

とのことで、この指定をしておくとcwdから親のディレクトリに向けて.perltidyrcを探しにいってくれます。これでホームディレクトリの設定に優先してプロジェクト毎の設定を反映してfixできますね。




以上の内容はhttps://masawada.hatenablog.jp/entry/2019/11/15/151627より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14