Skip to content

Instantly share code, notes, and snippets.



Created Apr 20, 2013
What would you like to do?
The getting started with ensime post!
// Add this file to ~/.sbt/plugins/plugins.sbt.
// Once this is ready, make sure you have sbt 0.12 ("brew install sbt" should do it),
// then try running
// sbt "ensime generate"
// in bijection's root directory. ("git clone")
resolvers += "Scala-Tools Maven2 Snapshots Repository" at ""
addSbtPlugin("org.ensime" % "ensime-sbt-cmd" % "0.1.1")
;; Make sure your package archives contain "melpa"
(setq package-archives
'(("gnu" . "")
("original" . "")
("org" . "")
("marmalade" . "")
("elpa" . "")
("melpa" . "")))
;; M-x package-list-packages
;; install scala-mode2
;; Download the latest ensime (
;; and move it over to ~/.emacs.d/ensime
;; Add the elisp directory your load-path:
(add-to-list 'load-path (concat dotfiles-dir "ensime/elisp"))
;; Now! some hooks to get things working:
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
(define-key ensime-mode-map (kbd "C-c C-b") 'ensime-inf-eval-buffer)
(define-key ensime-mode-map (kbd "C-c C-l") 'ensime-inf-load-file)
(define-key ensime-mode-map (kbd "C-c C-r") 'ensime-inf-eval-region)
(add-hook 'scala-mode-hook
'(lambda ()
;; Alternatively, bind the 'newline-and-indent' command and
;; 'scala-indent:insert-asterisk-on-multiline-comment' to RET in
;; order to get indentation and asterisk-insertion within multi-line
;; comments.
(local-set-key (kbd "RET")
'(lambda ()
;; Bind the 'join-line' command to C-M-j. This command is normally
;; bound to M-^ which is hard to access, especially on some European
;; keyboards. The 'join-line' command has the effect or joining the
;; current line with the previous while fixing whitespace at the
;; joint.
(local-set-key (kbd "C-M-j") 'join-line)
;; Bind the backtab (shift tab) to
;; 'scala-indent:indent-with-reluctant-strategy command. This is usefull
;; when using the 'eager' mode by default and you want to "outdent" a
;; code line as a new statement.
(local-set-key (kbd "<backtab>") 'scala-indent:indent-with-reluctant-strategy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment