Starting the REPL
Start the REPL with cider-jack-in
, before evaluating any Clojure expressions.
Basic Evaluation
Load the buffer with cider-load-buffer
(C-c C-k
), and execute the top level form under point with cider-eval-defun-at-point
(C-c C-c
).
C-x C-e
evaluates the form preceding point. You can also use C-c C-e
which binds to the same command cider-eval-last-sexp
.
C-u C-c C-c
prefixes the form with #dbg
, recursively inserting breakpoints to everything inside it. #break
instead just places one breakpoint in front of the form.
Once you drop into the CIDER debugger, check out https://docs.cider.mx/cider/debugging/debugger.html#keys for the commands and keys available. Notably, there are:
n
,i
ando
. Step next, in, or out.h
. Skip all sexps up to “here” (current position).c
. Continue till next breakpoint.C
. Continue without stopping.q
. Quit the debugger.e
. Eval code in current context.p
,P
andl
. Inspect the current value, an arbitrary expression, or local variables.
Inspector
To inspect the eval result, run cider-inspect-last-result
(SPC m i r
in Doom).
In the inspector view, use cider-inspector-pop
(L
in evil mode) to return to last view, and cider-inspector-next-inspectable-object
(type ] ]
or g j
in evil mode) to jump to next inspectable object. Use cider-inspector-next-page
(C-j
) to jump between pages if there are too many items.
Cheatsheet
M-x cider-cheatsheet-select
opens minibuffer to search the cheatsheet.
Refactoring (Hydra shortcut)
hydra-cljr-help-menu
(SPC m R
in Doom) is a Hydra menu for quick consecutive refactoring.
n am
adds missing libspec. It searchescljr-magic-require-namespaces
for aliases.p ap
adds project dependency. Requires existing:deps
key indeps.edn
.
{:deps {}}