REPL Keybindings
Here’s a list of the keybindings that are available in CIDER’s REPL:
Keyboard shortcut | Description |
---|---|
RET |
Evaluate the current input in Clojure if it is complete. If incomplete, open a new line and indent. If the current input is a blank string (containing only whitespace including newlines) then clear the input without evaluating and print a fresh prompt. If invoked with a prefix argument, then the input is evaluated without checking for completeness. |
C-RET |
Close any unmatched parentheses and then evaluate the current input in Clojure. |
C-j |
Open a new line and indent. |
C-c C-o |
Remove the output of the previous evaluation from the REPL buffer. With a prefix argument it will clear the entire REPL buffer, leaving only a prompt. |
C-c M-o |
Switch between the Clojure and ClojureScript REPLs for the current project. |
C-c C-u |
Kill all text from the prompt to the current point. |
C-c C-b |
Interrupt any pending evaluations. |
C-up |
Go to to previous/next input in history. |
M-p |
Search the previous/next item in history using the current input as search pattern. If M-p/M-n is typed two times in a row, the second invocation uses the same search pattern (even if the current input has changed). |
M-s |
Search forward/reverse through command history with regex. |
C-c C-n |
Move between the current and previous prompts in the REPL buffer. Pressing RET on a line with old input copies that line to the newest prompt. |
TAB |
Complete symbol at point. |
C-c C-d d |
Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol |
C-c C-d j |
Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol. |
C-c C-d c |
Lookup symbol in ClojureDocs. |
C-c C-d a |
Apropos search for functions/vars. |
C-c C-d f |
Apropos search for documentation. |
C-c C-z |
Switch to the previous Clojure buffer. This complements C-c C-z used in |
C-c M-i |
Inspect expression. Will act on expression at point if present. |
C-c M-n |
Select a namespace and switch to it. |
C-c C-. |
Jump to some namespace on the classpath. |
C-c M-t v |
Toggle var tracing. |
C-c M-t n |
Toggle namespace tracing. |
C-c C-t t |
Run test at point. |
C-c C-t a |
Re-run the last test you ran. |
C-c C-t n |
Run tests for current namespace. |
C-c C-t l |
Run tests for all loaded namespaces. |
C-c C-t p |
Run tests for all project namespaces. This loads all namespaces of the project. |
C-c C-t r |
Re-run failed and erring tests. |
C-c C-t b |
Show the test report buffer. |
C-c C-q |
Quit the current nREPL connection. With a prefix argument it will quit all connections. |
There’s no need to memorize this list. In any REPL buffer you’ll have a REPL
menu available, which lists the most important commands and their
keybindings. You can also invoke C-h f RET cider-repl-mode to get a list of the
keybindings for cider-repl-mode .
|
REPL Shortcuts
In the REPL you can also use "shortcut commands" by pressing ,
at the
beginning of a REPL line. You’ll be presented with a list of commands you can
quickly run (like quitting, displaying some info, clearing the REPL, etc). The
character used to trigger the shortcuts is configurable via
cider-repl-shortcut-dispatch-char
. Here’s how you can change it to ;
:
(setq cider-repl-shortcut-dispatch-char ?\;)