Setup vim for elixir development

Amirali Esmaeili
Jul 2 · 2 min read

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

Syntax highlighting

Simply install vim-elixir with your favourite plugin manager.

coc.nvim

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.

coc-elixir

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.

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

Conclusion

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!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade