X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/autoload/ale/fixers/elm_format.vim diff --git a/.vim/bundle/ale/autoload/ale/fixers/elm_format.vim b/.vim/bundle/ale/autoload/ale/fixers/elm_format.vim new file mode 100644 index 00000000..a4740db4 --- /dev/null +++ b/.vim/bundle/ale/autoload/ale/fixers/elm_format.vim @@ -0,0 +1,23 @@ +" Author: soywod +" Description: Integration of elm-format with ALE. + +call ale#Set('elm_format_executable', 'elm-format') +call ale#Set('elm_format_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('elm_format_options', '--yes') + +function! ale#fixers#elm_format#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'elm_format', [ + \ 'node_modules/.bin/elm-format', + \]) +endfunction + +function! ale#fixers#elm_format#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'elm_format_options') + + return { + \ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer)) + \ . ' %t' + \ . (empty(l:options) ? '' : ' ' . l:options), + \ 'read_temporary_file': 1, + \} +endfunction