Add perltidy

This commit is contained in:
Abdurrahman Aborazmeh 2015-11-30 06:19:22 +02:00
parent a5013d1a6a
commit 12a9d4c30c
2 changed files with 18 additions and 0 deletions

View File

@ -139,6 +139,9 @@ It can be installed using `cargo`, the Rust package manager. Up-to-date installa
* `dartfmt` for __Dart__.
Part of the Dart SDK (make sure it is on your PATH). See https://www.dartlang.org/tools/dartfmt/ for more info.
* `perltidy` for __Perl__.
It can be installed from CPAN `cpanm Perl::Tidy` . See https://metacpan.org/pod/Perl::Tidy and http://perltidy.sourceforge.net/ for more info.
How can I change the behaviour of formatters, or add one myself?
----------------------------------------------------------------
If you need a formatter that is not among the defaults, or if you are not satisfied with the default formatting behaviour that is provided by vim-autoformat, you can define it yourself.

View File

@ -211,3 +211,18 @@ endif
if !exists('g:formatters_dart')
let g:formatters_dart = ['dartfmt']
endif
" Perl
if !exists('g:formatdef_perltidy')
" use perltidyrc file if readable
if (has("win32") && (filereadable("perltid.ini") || filereadable($HOMEPATH."/perltidy.ini"))) ||
\ ((has("unix") || has("mac")) && (filereadable(".perltidyrc") || filereadable("~/.perltidyrc") || filereadable("/usr/local/etc/perltidyrc") || filereadable("/etc/perltidyrc")))
let g:formatdef_perltidy = '"perltidy -q -st"'
else
let g:formatdef_perltidy = '"perltidy --perl-best-practices --format-skipping -q "'
endif
endif
if !exists('g:formatters_perl')
let g:formatters_perl = ['perltidy']
endif