XUtils

ElmCast/elm-vim

Elm 0.18 mode for Vim/Neovim.


elm-vim

logo

Features

  1. Syntax highlighting
  2. Automatic indentation
  3. Function completion
  4. Build and package commands
  5. Code formatting and linting
  6. Documentation lookup
  7. REPL integration

Check out this ElmCast video for more detail.

Requirements

First, make sure you have the Elm Platform installed. The simplest method to get started is to use the official npm package.

npm install -g elm

In order to run unit tests from within vim, install elm-test

npm install -g elm-test

For code completion and doc lookups, install elm-oracle.

npm install -g elm-oracle

To automatically format your code, install elm-format.

npm install -g elm-format

Mappings

The plugin provides several <Plug> mappings which can be used to create custom mappings. The following keybindings are provided by default:

Keybinding Description
<LocalLeader>m Compile the current buffer.
<LocalLeader>b Compile the Main.elm file in the project.
<LocalLeader>t Runs the tests of the current buffer or ‘tests/TestRunner’.
<LocalLeader>r Opens an elm repl in a subprocess.
<LocalLeader>e Shows the detail of the current error or warning.
<LocalLeader>d Shows the type and docs for the word under the cursor.
<LocalLeader>w Opens the docs web page for the word under the cursor.

You can disable these mappings if you want to use your own.

let g:elm_setup_keybindings = 0

Integration

Ale

The preferred linter to use with elm-vim is Ale. It should work out of the box.

YouCompleteMe

let g:ycm_semantic_triggers = {
     \ 'elm' : ['.'],
     \}

Neocomplete

call neocomplete#util#set_default_dictionary(
  \ 'g:neocomplete#sources#omni#input_patterns',
  \ 'elm',
  \ '\.')

Screenshots

errors and completion

Credits

  • Other vim-plugins, thanks for inspiration (elm.vim, ocaml.vim, haskell-vim)
  • Contributors of elm-vim

Articles

  • coming soon...