If you use vim to work on scala projects that use sbt, then this might be for you. The intended workflow is to have a terminal window running sbt ~test
or sbt ~compile
or sbt ~scalastyle
or some such continuously while you use gvim/mvim in another window. With this sbt plugin and its companion vim plugin, whenever errors are detected, the offending code will be highlighted inline and you can jump between compile errors or test case failures with simple vim commands (I use the unimpaired plugin to jump around with ]l
, ]L
, [l
, [L
). For me, this is incredibly handy.
Unlike other solutions of this nature, this one does not hang vim while some slow syntax checker is run or otherwise slow down your system in any way. Instead, most recent output from sbt is captured to log files and then quickly slurped into vim by syntastic using the custom syntax checker in the companion vim-scala-async-integration vim plugin.
This is in some kind of alpha status as of Feb '16. I'm using it, but there are some little quirks and minor bugs. Despite that, I find it pretty usable. But because of that I haven't packaged this up or announced it yet.
Installation requires two parts. The first involves installing the SBT plugin and the second involves installing the vim plugin. For now, the SBT plugin is not packaged so you will need to manage it manually.
> git clone [email protected]:zmre/sbt-vim-async-integration.git
> cd sbt-vim-async-integration
> sbt publishLocal
> mkdir -p ~/.sbt/0.13/plugins
> echo 'addSbtPlugin("zmre" % "sbt-vim-async-integration" % "1.0-LOCAL")' >> ~/.sbt/0.13/plugins/plugins.sbt
Note: the mkdir will fail if that directory already exists, which is fine.
There are a ton of different ways to install vim plugins. I'll cover vundle and pathogen and you can figure the rest out on your own.
Add the following two lines to your vimrc file:
Bundle 'scrooloose/syntastic'
Bundle 'zmre/vim-scala-async-integration'
and then fire up vim and run :BundleInstall
.
> cd ~/.vim/bundle
> git clone [email protected]:zmre/vim-scala-async-integration.git
> git clone https://github.com/scrooloose/syntastic.git
This has borrowed heavily from sbt-quickfix.