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:
- Syntax highlighting
- Smart code completions
- Go to definition and Find references
- Hover docs
- Real time diagnostics
- 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!