Setup vim for elixir development

As the title says, it’s not a topic about choosing suitable editor / IDE for elixir development, you love vim and ofcourse elixir and all you need is a simple guide get a nice, fast and productive environment for elixir development in vim.

alongside with project wide searching , easy file switching and this kind of features which you can achieve with fzf.vim or something, in my opinion regardless of language youre coding in you need features listed below:

  1. Syntax highlighting
  2. Smart code completions
  3. Go to definition and Find references
  4. Hover docs
  5. Real time diagnostics
  6. Code formatter

Simply install vim-elixir with your favourite plugin manager.

To achieve the other features mentioned above we’ll use coc.nvim, a plugin which adds vscode like features to vim including a great Language Server support. Follow installation instructions and setup coc.nvim. note that you’ll need vim8+ or neovim and nodejs installed on your machine.

It’s just a port of ElixirLS VsCode. Make sure elixir and mix are available in path, Inside vim install coc-elixir using this command:

:CocInstall coc-elixir

Open an elixir project and see the magic.

Note: floating windows are available in neovim 0.4

Be sure to check coc.nvim docs for example configuration and keybindings, eg formatter shortcuts.

coc.nvim is very powerful yet easy to setup and configure, you can use different plugins to achieve a productive development environment. Configuration for other languages is as easy as you did for elixir

Happy Viming!