Saturday 15 May 2010

Vim syntax highlighting for Scala

Scala offers the flexibility to execute from command line (scala -e), through its REPL, as a script, or accessing the conventional main class. While REPL can be useful for quick hacks, the script has the advantage that it can be used for good shell scripts. On my Mac OS X Snow Leopard, (although it works on any unix) I configured vim as such:
curl http://lampsvn.epfl.ch/svn-repos/scala/scala-tool-support/trunk/src/vim/syntax/scala.vim -o .vim/syntax/scala.vim

curl http://lampsvn.epfl.ch/svn-repos/scala/scala-tool-support/trunk/src/vim/indent/scala.vim -o .vim/indent/scala.vim

curl http://lampsvn.epfl.ch/svn-repos/scala/scala-tool-support/trunk/src/vim/ftdetect/scala.vim -o .vim/ftdetect/scala.vim
then inside of vim, activate it:
:syntax on
Finally, to enable highlighting by default, add/modify your .vimrc and add the line
:syntax enable
Restart your console and you can now enjoy scala highlighting (although the color theme probably needs tweaking...)

No comments:

Post a Comment