Description
Features:
- Syntax highlighting for Elixir and EEx files
- Filetype detection for
.ex
,.exs
,.eex
,.heex
,.leex
, and.sface
files - Automatic indentation
- Integration between Ecto projects and [vim-dadbod][] for running SQL queries on defined Ecto repositories
Plugin Managers
If you are using a plugin manager then add vim-elixir
the way you would any other plugin:
# Using vim 8 native package loading
# http://vimhelp.appspot.com/repeat.txt.html#packages
git clone https://github.com/elixir-editors/vim-elixir.git ~/.vim/pack/my-packages/start/vim-elixir
# Using pathogen
git clone https://github.com/elixir-editors/vim-elixir.git ~/.vim/bundle/vim-elixir
" Using vim-plug
Plug 'elixir-editors/vim-elixir'
" Using Vundle
Plugin 'elixir-editors/vim-elixir'
" Using NeoBundle
NeoBundle 'elixir-editors/vim-elixir'
Configuration
You must add the following to your ~/.vimrc
:
" Enable syntax highlighting
syntax on
" Enables filetype detection, loads ftplugin, and loads indent
" (Not necessary on nvim and may not be necessary on vim 8.2+)
filetype plugin indent on
Notes/Caveats
Development
Maintenance Help
vim-elixir
is looking for new maintainers.
If you get a lot of value from it, know vimscript well, or eager to learn about it then feel free to get in touch with @jbodah (GH issue, elixir-lang Slack)
Developing in Docker
You can spawn a container with vim and your development configs using bin/vim
or bin/nvim
Debugging Indent
# Open vim in a container loading this plugin
bin/vim myfile.ex
# Debug statements should be configured to print automatically
# Write/indent some code
:messages
# You should see output like the following:
# ==> Indenting line 3
# text = ' _ -> :wowo'
# testing handler elixir#indent#handle_top_of_file
# testing handler elixir#indent#handle_starts_with_string_continuation
# testing handler elixir#indent#handle_following_trailing_binary_operator
# testing handler elixir#indent#handle_starts_with_pipe
# testing handler elixir#indent#handle_starts_with_binary_operator
# testing handler elixir#indent#handle_inside_block
# pattern matching relative to lnum 2
# current line contains ->; assuming match definition
# line 3: elixir#indent#handle_inside_block returned 4
# 1 change; before #1 4 seconds ago
#
# This tells you which line is being inspected as well as which handlers are being run
# and which branches are being exercised by those handlers