avh4/elm-format

Rework Vim install instructions

andys8 opened this issue · 2 comments

The current recommendation is to use elmcast/elm-vim. As of today, I'd not recommend using this plugin, because Elm 0.19 is still not supported for some things: ElmCast/elm-vim#182 and other issues https://github.com/ElmCast/elm-vim/issues

Alternatives

Ale

I'd recommend either using w0rp/ale, which has an elm-format fixer.

https://github.com/w0rp/ale/blob/8768a309b8ef1c2e819dcb6f4630f73acab59792/doc/ale-elm.txt#L6
https://github.com/w0rp/ale/blob/master/supported-tools.md

elm-language-server

Or use elm-format through elm-language-server. It'll solve more things, but formatting is a part of it.

https://github.com/elm-tooling/elm-language-server
https://github.com/elm-tooling/elm-language-server/blob/f84c65d3ff4ab0e3887900a10d55970321f8b07c/src/providers/documentFormatingProvider.ts

This might be helpful:

autocmd Filetype elm setlocal ts=4 sw=4 sts=4 expandtab nowrap

And for Neoformat:

augroup fmt
  autocmd!
  autocmd BufWritePre *.elm undojoin | Neoformat
augroup END

(thanks to @Janiczek)

@rofrol thanks for sharing! I couldn't get coc.nvim to format in my project, and using Neoformat with your (and @Janiczek's) suggestion worked very well.