Federico Ragona bio photo

Federico Ragona

Passionate software developer, jogger, and photographer based in Amsterdam, Netherlands.

Github Stackoverflow LinkedIn Twitter 500px

Over the last few days I’ve been evaluating Spacemacs as a replacement for Vim: I had already come to appreciate it because of its pleasant user experience and configurability but I was still missing a killer feature… Today I set out to explore Spacemacs’ scala configuration layer and guess what? I think I found one! By integrating with ensime, Spacemacs gains IDE-level features such as: infer variable type, organize imports, extract method, rename variable, jump to definition, and many more… That’s incredibly better than my previous setup (vim + sbt running on the side)! Setting up a project for Ensime integration is straightforward:

  • add ensime-sbt to your (global or local) plugins.sbt,
  • run sbt gen-ensime to generate the .ensime file,
  • start ensime server (SPC m n s).

Here are a few functions I find very useful:

Keybinding Function
SPC m g g go to definition
SPC m i i inspect type at point
SPC m r f format code
SPC m r i organize imports
SPC m r r rename a symbol project wide
SPC m s b send buffer to REPL
SPC m s r send region of code to REPL
SPC m t r run quick tests

Furthermore, while navigating a Scala file the current line’s method definition (or expression return type) will appear in the status bar.

For a complete list of features and keybindings, visit the official website.