Basic Usage

CIDER comes with a powerful REPL that complements the interactive development functionality in cider-mode. Using the CIDER REPL you can experiment with your running program, test functions, or just explore a new library you're interested in using. The CIDER REPL offers a number of advanced features:

  • auto-completion
  • font-locking (the same as in clojure-mode)
  • quick access to many CIDER commands (e.g. definition and documentation lookup, tracing, etc)
  • pretty-printing of evaluation results
  • eldoc support
  • highly customizable REPL prompt

Interacting with the REPL

Interacting with CIDER's REPL is pretty simple - most of the time you'd just write expressions there and press RET to evaluate them.

But the REPL is a bit more powerful than that and it allows you to do some things that might not be available in other Clojure REPLs. Some examples of such things would be:

  • You can close an incomplete expression with C-Ret
  • You can enter a multi-line expression by pressing C-j at the end of each line
  • You can quickly jump to the definition of a symbol (.) or to its documentation (C-c C-d d)
  • You can clear the output of the last expression with C-c C-o
  • You can clear the REPL buffer with C-u C-c C-o
  • You can jump between your source buffers and the REPL with C-c C-z
  • You can jump between your Clojure and ClojureScript REPLs with C-c M-o

On top of this the REPL is extremely configurable and you can tweak almost every aspect of it.

Interrupting Evaluations

If you accidentally try to evaluate something that's going to take a lot of time (if it finishes at all), you can interrupt the rouge evaluation operation by pressing C-c C-c.

Tip

Note that this is different from the keybinding for interrupting evaluations in source buffers, namely C-c C-b.

Quitting a REPL

When you're done with a REPL you can dispose of it with C-c C-q.

Please, avoid killing REPL buffers with C-c C-k

Known Limitations

Performance can degrade when the REPL buffer grows very large. This is especially true if either cider-repl-use-clojure-font-lock or nrepl-log-messages are enabled. You can use cider-repl-clear-output to either clear the result of the previous evaluation, or with a prefix argument clear the entire REPL buffer.

Very long lines are guaranteed to bring Emacs to a crawl, so using a value of cider-print-fn that wraps lines beyond a certain width (i.e. any of the built-in options except for pr) is advised.