summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorKanenobu Mitsuru <mkanenobu@users.noreply.github.com>2019-05-08 02:50:26 +0900
committerw0rp <w0rp@users.noreply.github.com>2019-05-07 18:50:26 +0100
commitc10da0e390b37ae6a739769dffb3b8dcf36a81d0 (patch)
treef0c61aca339761b7b75c2ef529cccffd38600072 /autoload
parent548ee56f401bf3dea7689b0b00c8fbecd2db48b1 (diff)
downloadale-c10da0e390b37ae6a739769dffb3b8dcf36a81d0.zip
Add fixer for OCaml ocp-indent (#2436)
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/ocp_indent.vim18
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 4802ee1b..3a36f367 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -220,6 +220,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['ocaml'],
\ 'description': 'Fix OCaml files with ocamlformat.',
\ },
+\ 'ocp-indent': {
+\ 'function': 'ale#fixers#ocp_indent#Fix',
+\ 'suggested_filetypes': ['ocaml'],
+\ 'description': 'Fix OCaml files with ocp-indent.',
+\ },
\ 'refmt': {
\ 'function': 'ale#fixers#refmt#Fix',
\ 'suggested_filetypes': ['reason'],
diff --git a/autoload/ale/fixers/ocp_indent.vim b/autoload/ale/fixers/ocp_indent.vim
new file mode 100644
index 00000000..e1b047b3
--- /dev/null
+++ b/autoload/ale/fixers/ocp_indent.vim
@@ -0,0 +1,18 @@
+" Author: Kanenobu Mitsuru
+" Description: Integration of ocp-indent with ALE.
+
+call ale#Set('ocaml_ocp_indent_executable', 'ocp-indent')
+call ale#Set('ocaml_ocp_indent_options', '')
+call ale#Set('ocaml_ocp_indent_config', '')
+
+function! ale#fixers#ocp_indent#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'ocaml_ocp_indent_executable')
+ let l:config = ale#Var(a:buffer, 'ocaml_ocp_indent_config')
+ let l:options = ale#Var(a:buffer, 'ocaml_ocp_indent_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (empty(l:config) ? '' : ' --config=' . ale#Escape(l:config))
+ \ . (empty(l:options) ? '': ' ' . l:options)
+ \}
+endfunction