summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorKenta, Kobayashi <kentafly88@gmail.com>2018-04-21 22:09:38 +0900
committerKenta, Kobayashi <kentafly88@gmail.com>2018-04-21 22:09:38 +0900
commit498be478be6b57cff90f4d2889e87bf0067d6dec (patch)
treec1d6f583733d3b2e7ba455e2754f3d369962a0d9 /autoload
parent20241c87ef9f033e2ac2f44f5bb99af358ab44b2 (diff)
downloadale-498be478be6b57cff90f4d2889e87bf0067d6dec.zip
add perltidy fixer
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/perltidy.vim18
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index d12cf0d4..7e45e6ad 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -185,6 +185,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['json'],
\ 'description': 'Fix JSON files with jq.',
\ },
+\ 'perltidy': {
+\ 'function': 'ale#fixers#perltidy#Fix',
+\ 'suggested_filetypes': ['perl'],
+\ 'description': 'Fix Perl files with perltidy.',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/perltidy.vim b/autoload/ale/fixers/perltidy.vim
new file mode 100644
index 00000000..a55a572b
--- /dev/null
+++ b/autoload/ale/fixers/perltidy.vim
@@ -0,0 +1,18 @@
+" Author: kfly8 <kentafly88@gmail.com>
+" Description: Integration of perltidy with ALE.
+
+call ale#Set('perl_perltidy_executable', 'perltidy')
+call ale#Set('perl_perltidy_options', '')
+
+function! ale#fixers#perltidy#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'perl_perltidy_executable')
+ let l:options = ale#Var(a:buffer, 'perl_perltidy_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' -b'
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction