= REPL Keybindings
:experimental:

Here's a list of the keybindings that are available in CIDER's REPL:

|===
| Keyboard shortcut | Description

| kbd:[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.

| kbd:[C-RET]
| Close any unmatched parentheses and then evaluate the current input in Clojure.

| kbd:[C-j]
| Open a new line and indent.

| kbd:[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.

| kbd:[C-c M-o]
| Switch between the Clojure and ClojureScript REPLs for the current project.

| kbd:[C-c C-u]
| Kill all text from the prompt to the current point.

| kbd:[C-c C-b] +
kbd:[C-c C-c]
| Interrupt any pending evaluations.

| kbd:[C-up] +
kbd:[C-down]
| Go to previous/next input in history.

| kbd:[M-p] +
kbd:[M-n]
| Search the previous/next item in history using the current input as search pattern. If kbd:[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).

| kbd:[M-s] +
kbd:[M-r]
| Search forward/reverse through command history with regex.

| kbd:[C-c C-n] +
kbd:[C-c C-p]
| Move between the current and previous prompts in the REPL buffer. Pressing kbd:[RET] on a line with old input copies that line to the newest prompt.

| kbd:[TAB]
| Complete symbol at point.

| kbd:[C-c C-d d] +
kbd:[C-c C-d C-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

| kbd:[C-c C-d j] +
kbd:[C-c C-d C-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.

| kbd:[C-c C-d c] +
kbd:[C-c C-d C-c]
| Lookup symbol in ClojureDocs.

| kbd:[C-c C-d a] +
kbd:[C-c C-d C-a]
| Apropos search for functions/vars.

| kbd:[C-c C-d f] +
kbd:[C-c C-d C-f]
| Apropos search for documentation.

| kbd:[C-c C-z]
| Switch to the previous Clojure buffer. This complements kbd:[C-c C-z] used in `cider-mode`.

| kbd:[C-c M-i]
| Inspect expression. Will act on expression at point if present.

| kbd:[C-c M-n]
| Select a namespace and switch to it.

| kbd:[C-c C-.]
| Jump to some namespace on the classpath.

| kbd:[C-c M-t v]
| Toggle var tracing.

| kbd:[C-c M-t n]
| Toggle namespace tracing.

| kbd:[C-c C-t t] +
kbd:[C-c C-t C-t]
| Run test at point.

| kbd:[C-c C-t a] +
kbd:[C-c C-t C-a]
| Re-run the last test you ran.

| kbd:[C-c C-t n] +
kbd:[C-c C-t C-n]
| Run tests for current namespace.

| kbd:[C-c C-t l] +
kbd:[C-c C-t C-l]
| Run tests for all loaded namespaces.

| kbd:[C-c C-t p] +
kbd:[C-c C-t C-p]
| Run tests for all project namespaces. This loads all namespaces of the project.

| kbd:[C-c C-t r] +
kbd:[C-c C-t C-r]
| Re-run failed and erring tests.

| kbd:[C-c C-t b] +
kbd:[C-c C-t C-b]
| Show the test report buffer.

| kbd:[C-c C-q]
| Quit the current nREPL connection. With a prefix argument it will quit all connections.
|===

TIP: 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 `;`:

[source,lisp]
----
(setq cider-repl-shortcut-dispatch-char ?\;)
----
