ENhanced Scala Interaction Mode for Emacs
Pull request Compare This branch is 943 commits ahead, 2339 commits behind ensime:3.0.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



the ENhanced Scala Interaction Mode for Emacs



  • Highlight errors and warnings in your code buffers.
  • Inspect the type of any expression.
  • Browse packages
  • Completion for variables, methods, constructors, etc.
  • Incrementally search through classpath symbols
  • Find all references to a symbol
  • Jump to symbol definitions.
  • Semantic Highlighting
  • Automated Refactorings (rename, organize imports, extract method)
  • Source Formatting
  • AST-based selection
  • Supports sbt7,10,11
  • Supports Maven,Ivy build descriptions
  • Embedded sbt shell
  • REPL
  • Debug support

Demo Videos

System Requirements

  • Emacs 22 or later.
  • Linux, Mac OSX, Windows
  • Java Runtime
  • A Scala 2.8.x or 2.9.x project


Getting Started

1) Install scala-mode

Although it's not required, ENSIME is designed to compliment scala-mode. scala-mode can be found in the Scala distribution under ./misc/scala-tool-support/emacs/.

2) Install the ENSIME Server

Download the ENSIME distribution from the github downloads page. Unpack the ENSIME distribution into a directory of your choosing.

Add the following lines to your .emacs file:

;; load the ensime lisp code...
(add-to-list 'load-path "ENSIME_ROOT/elisp/")
(require 'ensime)

;; This step causes the ensime-mode to be started whenever
;; scala-mode is started for a buffer. You may have to customize this step
;; if you're not using the standard scala mode.
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)

3) If you are using sbt, install the ENSIME Sbt Plugin (otherwise, see the manual)

Add the following lines to your project/plugins.sbt file:

addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "VERSION")

Replace VERSION with the latest version of the plugin, available on the plugin page. Then, from an sbt shell, generate your ENSIME project:

ensime generate

You should now have a .ensime file in the root of your project. There's no need to edit this file manually as you can now specify ENSIME settings directly from your sbt build file. Check the manual for details.

5) Start ENSIME

From inside Emacs, execute M-x ensime

Developer Quick Start

Note: This section is for people who want to hack on ENSIME itself.

After cloning, and before you can run ENSIME, you must create the distribution directory structure. The sbt task 'stage' will create the directory 'dist' underneath the root clone directory. Then, follow the install instructions in section 2.2 above, substituting CLONE_DIR/dist as the root of your ENSIME distribution.

The work-flow I use when hacking ENSIME:

  • Edit source files
  • 'sbt stage'
  • Stop existing ENSIME server by killing inferior-ensime-server buffer
  • Restart ENSIME with M-x ensime