avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 148 forks source link

Rework Vim install instructions #610

Open andys8 opened 5 years ago

andys8 commented 5 years ago

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: https://github.com/ElmCast/elm-vim/issues/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

rofrol commented 5 years ago

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)

jc00ke commented 4 years ago

@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.