Milad edited this page Aug 24, 2016 · 24 revisions


This plugin uses alchemist-server to give inside about your elixir project in vim.



  • Elixir > v1.0 to run alchemist-server
  • Python alchemist_client is the script that talks to alchemist-server
  • vim-elixir to enable syntax highlighting, indentation and etc.

Setting up

You can use your favourite VIM plugin mannger for installation, in this doc we use Vundle

Add this line to your .vimrc

Plugin 'slashmili/alchemist.vim'

Important Notes:

  • alchemist-server is included into this plugin and YOU DON'T NEED to set it up separately
  • auto complete and jump to definition only works if your project or newly added file has been compiled. Usually it's not a problem if you are building a web app with phoenix, because it gets compiled automatically while mix phoenix.server is running.

Omni completion

Short keys

  • Auto completion: <C-x><C-o> while your are in INSERT mode.

Optional plugin



By default the docs are shown as markdown.

Short keys

  • Press K while cursor is under a module or function in NORMAL mode.


  • ExDoc: ExDoc [module/function] provides document (press TAB to get autocomplete).

Optional plugin

  • AnsiEsc to see the docs in ansi color


Jump to definition

This plugin works with user defined and downloaded hex packages, for Jumping to Elixir/Erlang source code look at g:alchemist#elixir_erlang_src configs.

Short keys

  • Jump to the definition: Press <C-]> while cursor is under the keyword in NORMAL mode.
  • Jump through tag stack: Press <C-T> to jump between tag stack in NORMAL mode.


  • ExDef: ExDef [module/function] jumps to the definition.


  • Disable short keys

In case you don't like alchemist.vim semi-tag functionality!

let g:alchemist_tag_disable = 1
  • Change short keys bindings
let g:alchemist_tag_map = '<C-]>'
let g:alchemist_tag_stack_map = '<C-T>'
  • Set source path for Elixir and Erlang

If you haven't build Elixir/Erlang from source, you need to set g:alchemist#elixir_erlang_src to be able to jump to Elixir/Erlang modules.

let g:alchemist#elixir_erlang_src = "/usr/local/share/src"

This directory should contains two directories, elixir and otp

├── elixir
│ ├── CHANGELOG.md
│ ├── lib
│ ├── Makefile
│ ├── ...
├── otp
│ ├── lib
│ │ ├── asn1
│ │ ├── stdlib
│ │ ├── ...
│ ├── ...



IEx shell within vim requires either Neovim or ConqueShell. For ConqueShell the setting g:ConqueTerm_CloseOnEnd should be enabled to properly exit IEx.


  • IEx: IEx [command] opens a new IEx session if none exists (iex -S mix). If one already exists, it switches to that window (or reopens the window if it was closed). can take a command, which it will run. For example: :IEx h Enum.reverse
  • IExHide: hides the window that the IEx session is in.


  • Set IEx terminal size. :IEx opens a new horizontal split for the IEx session. The size of the split can be configured by changing g:alchemist_iex_term_size.
let g:alchemist_iex_term_size = 15
  • Set IEx window split
let g:alchemist_iex_term_split = 'split'



Allows you to run Mix commands from vim.

If you already have an existing Mix command/plugin in vim, Alchemist won't redefine this command.


  • Mix: Mix [command] run mix command (press TAB to get commands autocomplete).