summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-04-22 18:02:19 +0100
committerGitHub <noreply@github.com>2018-04-22 18:02:19 +0100
commit5a365e792693373413984a7eae2d64f7d92c1238 (patch)
tree78a1d829122f1dc5a812bc457a13fb2c9b94c30d /autoload
parent87ad4dfbe78665029521667afb2f159f3865523b (diff)
parent498be478be6b57cff90f4d2889e87bf0067d6dec (diff)
downloadale-5a365e792693373413984a7eae2d64f7d92c1238.zip
Merge pull request #1517 from kfly8/perltidy-fixer
Added 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