ENSIME for the Editor of the Beast (Vim)
You need websocket-client
python package:
$ sudo pip install websocket-client
You should also export your BROWSER variable, for example in your bashrc:
export BROWSER=firefox
All the following commands should be run from your scala directory.
First you need ensime sbt plugin:
$ echo 'addSbtPlugin("org.ensime" % "ensime-sbt" % "0.1.7")' \
>> ~/.sbt/0.13/plugins/plugins.sbt
Then, generate .ensime file:
$ sbt gen-ensime
Then install vim plugin, with Vundle, by adding to your .vimrc:
Plugin 'ensime/ensime-vim'
Or if you're using neovim, with vim-plug by installing neovim python module:
$ pip install neovim
and by adding to your .nvimrc:
Plug 'ensime/ensime-vim'
Then by doing a :PlugInstall and a :UpdateRemotePlugins under neovim
Finally, launch vim with the file(s) you want to edit:
$ vim src/scaloid/example/HelloScaloid.scala
Under neovim, for all commands except autocomplete, events are only handled when you move your cursor (CursorMoved event). Under vim, we use CursorHold event.
User documentation is available, you can also load it inside vim via:
:help ensime-vim
vim plugin is generated from neovim plugin. You should install neo2vim ruby gem:
$ gem install neo2vim
Then you should do your modifications to:
rplugin/python/ensime.py
And export them to vim plugin format via:
$ neo2vim rplugin/python/ensime.py ftplugin/scala_ensime.vim
All merges should be done on dev branch before being merged onto master
It is possible to register callbacks and send events to ensime. Check this plugin example.
Needs some love. Please get in contact if you would like to help! There was some old work that is no longer compatible with the ENSIME server but it may serve as a good starting place:
- https://github.com/megaannum/vimside
- https://github.com/jlc/envim
- https://github.com/psuter/vim-ensime \ https://github.com/andreypopp/ensime
Reference launch script is https://gist.github.com/fommil/4ff3ad5b134280de5e46 (only works on Linux but should be adaptable to OS X)