Instructions to get started with Elm tooling in Vim.
Install elm-language-server
and its dependencies. It provides most features, e.g. diagnostics (elm make
), linting, jump to definition, formatting (elm-format
) and more. It is a standalone implementation of the language server protocol (LSP). There exist multiple language server client implementations (e.g. CoC or ale).
CoC
. Look into elm-language-server README or CoC
wiki for setup and usage instructions.ale
and use elm_ls
linter. See elm-language-server
README, ale
README and ale
docs for usage instructions.LanguageClient-neovim
and see elm-language-server README.If you have Vim> 8.2 patch 929 or neovim, Elm syntax is already included in Vim!
(Alternatively install elm-vim-syntax
to add syntax highlighting and indentation.)
elm-format
is used by elm-language-server
to format code. An alternative is ale
's elm-format
fixer.
vim-sleuth
will set shiftwidth
and expandtab
according to your current file (or other similar files in your project). It is a great addition to elm-format
and a Elm syntax.
elm-language-server
provides snippets (e.g. with CoC
).
An alternative is to install Ultisnips
for snippet functionality. Install honza/vim-snippets
which contains elm.snippets
Install vim-test
to run tests. It contains elmtest.vim
. :TestFile
will execute elm-test
.
Install majutsushi/tagbar
and configure content displayed in the tagbar.
let g:tagbar_type_elm = { \ 'kinds' : [ \ 'f:function:0:0', \ 'm:modules:0:0', \ 'i:imports:1:0', \ 't:types:1:0', \ 'a:type aliases:0:0', \ 'c:type constructors:0:0', \ 'p:ports:0:0', \ 's:functions:0:0', \ ] \}
There is an example configuration to showcase a small Vim setup for Elm.
It's a good idea to take a look how others are configuring their environments. Here are some examples:
andys8/dotfiles
Augustin82/vim
antoine-atmire/vim-elmc
pehota/dotfiles
hulufei/dotfiles
Miaxos/Home-
leojpod/dotfiles
Frequently asked questions. Feel free to contribute.
"How do I configure CoC and set up keybindings?"Start with the official CoC example configuration
. Then start to look into our example configuration and user configurations. It'll take some time and tweaking until you find a configuration that's perfect for you.
Add "coc.preferences.formatOnSaveFiletypes": ["elm"]
to coc-settings.json
.
With CoC you can use :CocInfo
to see all client/server messages or :CocOpenLog
to show the log. Set elmLS.trace.server
to verbose
. Make sure you're using a valid elm project with an elm.json
file or verify behavior with elm-spa-example
.
CoC uses floating windows to display diagnostics (error messages). By default only the first 8 lines are shown.
diagnostic.maxWindowHeight
diagnostic.messageTarget
"echo"
insteadAdd a elm-analyse.json
config file like this and add check names. We're not using elm-analyse anymore, but this should still work for most rules.
{ "checks": { "UnusedTypeAlias": false } }"What about
ElmCast/elm-vim
and Zaptic/elm-vim
?"
ElmCast/elm-vim
is an older vim plugin people used before there existed a language server implementation. We're grateful it existed in the past, but the plugin seems to be unmaintained and isn't necessary anymore.
Zaptic/elm-vim
is a maintained fork. It can be a simple alternative to the elm-language-server
with fewer features and easier setup.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4