# Clojure contribution layer for Spacemacs
![logo_clojure](img/clojure.png) ![logo_cider](img/cider.png)
**Table of Contents**
- [Clojure contribution layer for Spacemacs](#clojure-contribution-layer-for-spacemacs)
- [Description](#description)
- [Packages Included](#packages-included)
- [Install](#install)
- [Layer](#layer)
- [Pretty Symbols](#pretty-symbols)
- [Cider](#cider)
- [Key Bindings](#key-bindings)
- [Documentation](#documentation)
- [Evaluation](#evaluation)
- [Goto](#goto)
- [REPL](#repl)
- [Tests](#tests)
## Description
This layer adds support for [Clojure][] language using [Cider][].
## Packages Included
- [Cider][]
- [clojure-mode][]
- [Clj Refactor][]
- [Cider Auto Complete][]
- [align-cljlet][]
## Install
### Layer
To use this contribution add it to your `~/.spacemacs`
```elisp
(setq-default dotspacemacs-configuration-layers '(clojure))
```
### Pretty Symbols
Pretty symbols for anonymous functions, set literals and partial, like `(λ [a] (+ a 5))`, `ƒ(+ % 5)`, `∈{2 4 6}` and `Ƥ`.
To enable this feature, add the following snippet to the dotspacemacs/config
section of your `~/.spacemacs` file:
```elisp
(setq clojure-enable-fancify-symbols t)
```
Or set this variable when loading the configuration layer:
```elisp
(setq-default dotspacemacs-configuration-layers
'((clojure :variables clojure-enable-fancify-symbols t)))
```
### Cider
Cider requires nRepl middleware to function, please check the installation
instructions at the [cider repository][cider_install].
## Key Bindings
### Documentation
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m d d | cider doc
SPC m d g | cider grimoire
SPC m d j | cider javadoc
### Evaluation
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m e b | eval buffer
SPC m e r | eval region
SPC m e s | eval last sexp
### Goto
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m g g | goto var
SPC m g e | goto error
SPC m g r | goto resource
SPC m g b | go back
### REPL
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m s b | send and eval buffer in REPL
SPC m s B | send and eval buffer and switch to REPL in `insert state`
SPC m s e | send and eval last sexp in REPL
SPC m s E | send and eval last sexp and switch to REPL in `insert state`
SPC m s f | send and eval function in REPL
SPC m s F | send and eval function and switch to REPL in `insert state`
SPC m s i | start REPL
SPC m s n | send and eval ns form in REPL
SPC m s N | send and eval ns form and switch to REPL in `insert state`
SPC m s s | switch to REPL
### Tests
Key Binding | Description
----------------------|------------------------------------------------------------
SPC m t t | run tests
### Refactoring
Key Binding | Description
------------------------|------------------------------------------------------------
SPC m r a d | add declaration
SPC m r a i | add import to ns
SPC m r a m | add missing libspec
SPC m r a p | add project dependency
SPC m r a r | add require to ns
SPC m r a u | add use to ns
SPC m r c c | cycle coll
SPC m r c i | cycle if
SPC m r c n | clean ns
SPC m r c p | cycle privacy
SPC m r d k | destructure keys
SPC m r e f | extract function
SPC m r e l | expand let
SPC m r f u | find usages
SPC m r h d | hotload dependency
SPC m r i l | introduce let
SPC m r m f | move form
SPC m r m l | move to let
SPC m r p c | project clean
SPC m r p f | promote function
SPC m r r d | remove debug fns
SPC m r r f | rename file
SPC m r r l | remove let
SPC m r r r | remove unused requires
SPC m r r s | rename symbol
SPC m r r u | replace use
SPC m r s n | sort ns
SPC m r s p | sort project dependencies
SPC m r s r | stop referring
SPC m r t f | thread first all
SPC m r t h | thread
SPC m r t l | thread last all
SPC m r u a | unwind all
SPC m r u w | unwind
[Clojure]: http://clojure.org
[Cider]: https://github.com/clojure-emacs/cider
[cider_install]: https://github.com/clojure-emacs/cider#installation
[clojure-mode]: https://github.com/clojure-emacs/clojure-mode
[Clj Refactor]: https://github.com/clojure-emacs/clj-refactor.el
[Cider Auto Complete]: https://github.com/clojure-emacs/ac-cider
[align-cljlet]: https://github.com/gstamp/align-cljlet