Keybindings
This is the reference for `cider-mode’s keybindings - the commands available in Clojure(Script) source buffers once you’ve connected a REPL. They’re grouped by task; the printable quick-reference card covers the same ground on a single page.
|
This page covers source-buffer bindings. A few related references:
|
Discovering keybindings
Emacs can always tell you what’s bound right now, which is handy given CIDER’s many prefix keys:
| Keyboard shortcut | Description |
|---|---|
C-h m |
Describe the current major/minor modes, including a full list of active bindings. |
C-h k key |
Describe the command bound to key. |
C-h b |
List all key bindings active in the current buffer. |
prefix C-h |
Show every binding that starts with prefix (e.g. C-c C-d C-h). |
| Install which-key and CIDER’s prefixes become self-documenting - pause after a prefix like C-c C-d and a popup lists the keys that follow. See Using cider-mode for more. |
Starting and stopping CIDER
C-c C-x opens the cider-start-menu transient, from which you pick how to
start or connect to a session. The most common entries:
| Keyboard shortcut | Command | Description |
|---|---|---|
C-c C-x j j |
|
Start an nREPL server for the project and connect to it (Clojure). |
C-c C-x j s |
|
Start an nREPL server and connect to it (ClojureScript). |
C-c C-x j m |
|
Start a server and connect both a Clojure and a ClojureScript REPL. |
C-c C-x c j |
|
Connect to an already-running nREPL server (Clojure). |
C-c C-x c s |
|
Connect to an already-running nREPL server (ClojureScript). |
C-c C-q |
|
Quit the current connection. |
C-c M-r |
|
Restart the current connection. |
| C-c C-x shows the whole menu (jack-in, connect, connect-sibling), so you don’t have to memorize the suffixes. See Up and Running. |
Evaluating code
| Keyboard shortcut | Command | Description |
|---|---|---|
C-x C-e (also C-c C-e) |
|
Evaluate the form preceding point and show the result in the echo area. |
C-c C-c (also C-M-x) |
|
Evaluate the top-level form containing point (redefine it in the running program). |
C-c C-v v |
|
Evaluate the form around point. |
C-c C-v l |
|
Evaluate the list around point. |
C-c C-v r |
|
Evaluate the active region. |
C-c C-v s |
|
Evaluate the region if one is active, otherwise the top-level form. |
C-c C-v z |
|
Evaluate the enclosing top-level form up to point. |
C-c C-v w |
|
Evaluate the form preceding point and replace it with the result. |
C-c M-e |
|
Evaluate the form preceding point and send the result to the REPL. |
C-c C-p |
|
Evaluate the form preceding point and pretty-print the result in a popup. |
C-c C-f |
|
Evaluate the top-level form and pretty-print the result in a popup. |
C-c M-; |
|
Evaluate the top-level form and insert the result as a comment. |
C-c M-: |
|
Read a Clojure expression from the minibuffer and evaluate it. |
C-c M-i |
|
Evaluate an expression and open the result in the inspector. |
| See Code Evaluation for the evaluation commands and their prefix-argument variations. |
Loading code
| Keyboard shortcut | Command | Description |
|---|---|---|
C-c C-k |
|
Load (evaluate) the current buffer. |
C-c C-l |
|
Load a file, prompting for its name. |
C-c C-M-l |
|
Load all files under a directory, prompting for it. |
Navigating code
| Keyboard shortcut | Command | Description |
|---|---|---|
M-. |
|
Jump to the definition of the symbol at point. |
M-, |
|
Return to where you were before the last jump. |
C-c C-. |
|
Jump to a namespace, selected via completion. |
C-c C-: |
|
Jump to the definition of the namespaced keyword at point. |
C-c M-. |
|
Jump to a classpath resource referenced by the string at point. |
C-c C-? r |
|
Show the usages of the function at point in a dedicated buffer. |
C-c C-? C-r |
|
Show the usages of the function at point in a minibuffer selector. |
C-c C-? s |
|
Search the project’s source for references to the symbol at point. |
C-c C-? d |
|
Show the functions used by the function at point. |
C-c C-? C-d |
|
Show the functions used by the function at point in a minibuffer selector. |
C-c C-w c |
|
Browse the callers of the function at point as a tree. |
C-c C-w d |
|
Browse the functions the function at point calls, as a tree. |
C-c C-w m |
|
Find a macro’s use sites by searching the project’s source. |
C-c C-w i |
|
Browse the types that implement the protocol at point. |
C-c C-w t |
|
Browse the protocols a type implements. |
C-c C-w p |
|
Browse the protocols that declare a given method. |
C-c M-s |
|
Quickly jump to an important buffer (REPL, docs, stacktrace, etc.). |
| See Code Navigation and Browsing for the complete navigation and call-graph toolkit. |
Looking up documentation
| Keyboard shortcut | Command | Description |
|---|---|---|
C-c C-d d |
|
Show documentation for the symbol at point. |
C-c C-d j |
|
Open the Javadoc for the symbol at point in a browser. |
C-c C-d a |
|
Search for definitions matching a pattern. |
C-c C-d f |
|
Search documentation strings matching a pattern. |
C-c C-d c |
|
Show ClojureDocs documentation for the symbol at point. |
C-c C-d w |
|
Open the symbol’s ClojureDocs page in a browser. |
| See Working with Documentation for more. |
Macroexpansion
C-c M-m opens the cider-macroexpand-menu transient; the keys below
are its suffixes, so C-c M-m a means "open the menu, then press a".
|
| Keyboard shortcut | Command | Description |
|---|---|---|
C-c C-m (also C-c M-m 1) |
|
Expand the macro call at point once. |
C-c M-m a |
|
Fully expand the macro call at point. |
C-c M-m e |
|
Step through the expansion inline in the source buffer (requires |
C-c M-m E |
|
Fully expand the macro at point inline in the source buffer. |
C-c M-m b |
|
Run a macro-stepping session in a dedicated popup buffer. |
| See Macroexpansion for details. |
Working with namespaces
| Keyboard shortcut | Command | Description |
|---|---|---|
C-c M-n n |
|
Switch the REPL to the current buffer’s namespace. |
C-c M-n e |
|
Evaluate the |
C-c M-n r |
|
Reload changed namespaces (via |
C-c M-n l |
|
Reload the current namespace with |
C-c M-n b |
|
Browse the contents of a namespace. |
C-c C-u |
|
Undefine a symbol. |
C-c C-M-u |
|
Undefine all symbols and aliases in the namespace. |
| See Code Reloading for the reloading workflow. |
Testing
| Keyboard shortcut | Command | Description |
|---|---|---|
C-c C-t t |
|
Run the test at point. |
C-c C-t n |
|
Run the tests in the current namespace. |
C-c C-t l |
|
Run all currently loaded tests. |
C-c C-t p |
|
Run all the project’s tests. |
C-c C-t a |
|
Re-run the last test you ran. |
C-c C-t r |
|
Re-run only the failing tests. |
C-c C-t b |
|
Show the test report buffer. |
| See Running Tests for the full test runner. |
Debugging and tracing
| Keyboard shortcut | Command | Description |
|---|---|---|
C-u C-M-x (also C-u C-c C-c) |
|
Instrument the top-level form and step through it in the debugger. |
C-c M-t v |
|
Toggle tracing of the var at point. |
C-c M-t n |
|
Toggle tracing of a whole namespace. |
Interacting with the REPL
| Keyboard shortcut | Command | Description |
|---|---|---|
C-c C-z |
|
Switch between the source buffer and the REPL. |
C-c M-z |
|
Load the current buffer and switch to the REPL. |
C-c M-p |
|
Copy the form preceding point into the REPL prompt. |
C-c C-j c |
|
Copy the top-level form into the namespace’s rich |
C-c C-j v |
|
Move point into the namespace’s rich |
C-c C-o |
|
Clear the output of the last evaluation from the REPL. |
C-c M-d |
|
Show information about the current connection. |
C-c C-b |
|
Interrupt any pending evaluations. |
Completion
CIDER completes the symbol at point through the standard
completion-at-point mechanism, so it’s normally bound to M-TAB (and
triggered automatically by completion UIs like company or corfu). See
Code Completion for details.
Printable reference card
CIDER also ships a one-page, printable quick-reference card covering these
essentials, meant to be printed and kept on your desk. You can find the PDF (and
its source) in the
refcard directory
of the CIDER repository.