Adding the Clojure layer to Spacemacs provides great support for the language via CIDER, Clojure-mode, clj-refactor and lots of useful tools.
The Clojure layer also adds to the auto-completion layer, providing matches for anything currently defined in the current namespace. The yasnippets package also allows you to expand shortcuts for common Clojure code structures, eg. def, defn, let, require.
Clojure support in Spacemacs is configured by adding the clojure layer. Edit
./spacemacs and add
clojure to the list of layers defined in
For an example, see my spacemacs configuration on github. Please note that there are more configuration options added to this file than required for Clojure, only add the ones you understand.
Restarting Emacs will download by the related packages for Clojure.
You can also use
SPC f e R(evil mode) or
M-m f e R(holy mode) to reload the Spacemacs configuration and download packages, however for a big layer I have found a restart of Emacs is needed to load in all the new configuration.
You can configure the Clojure layer to use pretty symbols to represent a few things in Clojure, such as:
To enable this feature, edit the
./spacemacs file and add the following snippet to the
Install Leiningen using the instructions on Leiningen.org, or if you already have Leiningen installed then check you have the latest version via
Leiningen should be version 2.6.x or greater as of 22nd February 2015
If you are using CIDER 0.11 or greater then you are done, as from this version the Leiningen dependencies are automatically injected when you start
Edit the Leiningen profile configuration for your useer, eg.
~/.lein/profiles.clj and add the following plugins and dependencies:
cider-nrepl plugin should match the version of CIDER used in Spacemacs, found by using
M-x cider-version. You will see a warning message in the REPL buffer if the versions do not match, for example:
Now you have the Clojure layer and Leiningen configured so you can create your Clojure apps with ease. Next time we will show how to use the REPL to evaluate code, giving you almost instant feedback on what you have created.
This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket