Clone this wiki locally
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.
You can use your favourite VIM plugin mannger for installation, in this doc we use Vundle
Add this line to your
- 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.serveris running.
- Auto completion:
<C-x><C-o>while your are in INSERT mode.
By default the docs are shown as markdown.
Kwhile cursor is under a module or function in NORMAL mode.
ExDoc [module/function]provides document (press TAB to get autocomplete).
- 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.
- 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 [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
/usr/local/share/src ├── elixir │ ├── CHANGELOG.md │ ├── lib │ ├── Makefile │ ├── ... ├── otp │ ├── AUTHORS │ ├── lib │ │ ├── asn1 │ │ ├── stdlib │ │ ├── ... │ ├── ...
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.
:IExopens a new horizontal split for the IEx session. The size of the split can be configured by changing
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 [command]run mix command (press TAB to get commands autocomplete).