clojure Setting up your development environment Spacemacs + CIDER


Spacemacs is a distribution of emacs that comes with a lot of packages preconfigured and easily installed. Also, it is very friendly for those who are familiar with vim style of editing. Spacemacs provides a CIDER-based Clojure layer.

To install and configure it for use with Clojure, first install emacs. Then make a backup of your previous configurations:

$ mv ~/.emacs.d ~/.emacs.d.backup

Then clone the spacemacs' repository:

$ git clone ~/.emacs.d

Now, open emacs. It will ask you some questions regarding your preferences. Then it downloads more packages and configures your emacs. After that the spacemacs is installed, you are ready to add Clojure support. Press SPC f e d to open your .spacemacs file for configuration. Find dotspacemacs-configuration-layers in the file, under it there is an open paren. Anywhere in between the parens in a new line type clojure.

(defun dotspacemacs/layers ()
   ;; ...
     ;; ...
   ;; ...

Press SPC f e R to save and install the clojure layer. Now, in any .clj file if you press , s i spacemacs will try to spawn a new clojure REPL connection to your project, and if it succeeds it will show in the statusbar, which afterwards you can press , s s to open a new REPL buffer to evaluate your codes.

For more information about spacemacs and cider contact their documentations. Spacemacs docs, Cider docs