diff --git a/README.md b/README.md index f2ba995..ade60b3 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ let g:elm_browser_command = "" let g:elm_detailed_complete = 0 let g:elm_format_autosave = 1 let g:elm_format_fail_silently = 0 +let g:elm_format_command = "elm-format" let g:elm_setup_keybindings = 1 ``` diff --git a/autoload/elm.vim b/autoload/elm.vim index 0e44176..552e00c 100644 --- a/autoload/elm.vim +++ b/autoload/elm.vim @@ -40,7 +40,7 @@ endf " Vim command to format Elm files with elm-format function! elm#Format() abort " check for elm-format - if elm#util#CheckBin('elm-format', 'https://github.com/avh4/elm-format') ==# '' + if elm#util#CheckBin(g:elm_format_command, 'https://github.com/avh4/elm-format') ==# '' return endif @@ -61,7 +61,7 @@ function! elm#Format() abort call writefile(getline(1, '$'), l:tmpname) " call elm-format on the temporary file - let l:out = system('elm-format ' . l:tmpname . ' --output ' . l:tmpname) + let l:out = system(g:elm_format_command . ' ' . l:tmpname . ' --output ' . l:tmpname) " if there is no error if v:shell_error == 0 diff --git a/doc/elm-vim.txt b/doc/elm-vim.txt index d62a2da..1cdf6fe 100644 --- a/doc/elm-vim.txt +++ b/doc/elm-vim.txt @@ -216,6 +216,13 @@ This setting toggles whether format errors show be display. let g:elm_format_fail_silently = 0 < + *'g:elm_format_command'* + +This setting changes the command used to run elm-format. +> + let g:elm_format_command = "elm-format" +< + =============================================================================== TROUBLESHOOTING *elm-troubleshooting* diff --git a/ftplugin/elm.vim b/ftplugin/elm.vim index e39be65..300e4b9 100644 --- a/ftplugin/elm.vim +++ b/ftplugin/elm.vim @@ -31,6 +31,10 @@ if !exists('g:elm_format_fail_silently') let g:elm_format_fail_silently = 0 endif +if !exists('g:elm_format_command') + let g:elm_format_command = "elm-format" +endif + if !exists('g:elm_setup_keybindings') let g:elm_setup_keybindings = 1 endif