Skip to content

Commit 842bdbf

Browse files
committed
Add a section dedicated to cider-repl-mode in "Basic Usage"
1 parent 5a1533f commit 842bdbf

File tree

1 file changed

+57
-47
lines changed

1 file changed

+57
-47
lines changed

README.md

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ specific CIDER release.**
4646
- [Launch a nREPL server and client from Emacs](#launch-a-nrepl-server-and-client-from-emacs)
4747
- [Connect to a running nREPL server](#connect-to-a-running-nrepl-server)
4848
- [Using cider-mode](#using-cider-mode)
49+
- [Using the REPL](#using-the-repl)
4950
- [ClojureScript usage](#clojurescript-usage)
5051
- [Keyboard shortcuts](#keyboard-shortcuts)
51-
- [cider-repl-mode](#cider-repl-mode)
5252
- [cider-macroexpansion-mode](#cider-macroexpansion-mode)
5353
- [cider-inspector-mode](#cider-inspector-mode)
5454
- [cider-test-report-mode](#cider-test-report-mode)
@@ -417,6 +417,62 @@ active you'll have a CIDER menu available, which lists all the most important
417417
commands and their keybindings. You can also invoke `C-h f RET cider-mode` to
418418
get a list of the keybindings for `cider-mode`.
419419

420+
### Using the REPL
421+
422+
CIDER comes with a powerful REPL, which is quite handy when you want to
423+
experiment with the code you're working on or just explore some stuff (e.g. a
424+
library you're playing with). The REPL offers a number of advanced features:
425+
426+
* auto-completion
427+
* font-locking (the same as in `clojure-mode`)
428+
* quick access to many CIDER commands (e.g. definition and documentation lookup, tracing, etc)
429+
430+
Here's a list of the keybindings that are available in CIDER's REPL:
431+
432+
Keyboard shortcut | Description
433+
-------------------------------------|------------------------------
434+
<kbd>RET</kbd> | Evaluate the current input in Clojure if it is complete. If incomplete, open a new line and indent. If invoked with a prefix argument is given then the input is evaluated without checking for completeness.
435+
<kbd>C-RET</kbd> | Close any unmatched parenthesis and then evaluate the current input in Clojure.
436+
<kbd>C-j</kbd> | Open a new line and indent.
437+
<kbd>C-c C-o</kbd> | 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.
438+
<kbd>C-c M-o</kbd> | Switch between the Clojure and ClojureScript REPLs for the current project.
439+
<kbd>C-c C-u</kbd> | Kill all text from the prompt to the current point.
440+
<kbd>C-c C-b</kbd> <kbd>C-c C-c</kbd>| Interrupt any pending evaluations.
441+
<kbd>C-up</kbd> <kbd>C-down</kbd> | Goto to previous/next input in history.
442+
<kbd>M-p</kbd> <kbd>M-n</kbd> | Search the previous/next item in history using the current input as search pattern. If <kbd>M-p/M-n</kbd> is typed two times in a row, the second invocation uses the same search pattern (even if the current input has changed).
443+
<kbd>M-s</kbd> <kbd>M-r</kbd> | Search forward/reverse through command history with regex.
444+
<kbd>C-c C-n</kbd> <kbd>C-c C-p</kbd> | Move between the current and previous prompts in the REPL buffer. Pressing <kbd>RET</kbd> on a line with old input copies that line to the newest prompt.
445+
<kbd>C-c C-x</kbd> | Reload all modified files on the classpath.
446+
<kbd>C-u C-c C-x</kbd> | Reload all files on the classpath.
447+
<kbd>TAB</kbd> | Complete symbol at point.
448+
<kbd>C-c C-d d</kbd> | 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
449+
<kbd>C-c C-d j</kbd> | 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.
450+
<kbd>C-c C-d r</kbd> | Lookup symbol in Grimoire.
451+
<kbd>C-c C-d a</kbd> | Apropos search for functions/vars.
452+
<kbd>C-c C-d A</kbd> | Apropos search for documentation.
453+
<kbd>C-c C-z</kbd> | Switch to the previous Clojure buffer. This complements <kbd>C-c C-z</kbd> used in cider-mode.
454+
<kbd>C-c M-i</kbd> | Inspect expression. Will act on expression at point if present.
455+
<kbd>C-c M-n</kbd> | Select a namespace and switch to it.
456+
<kbd>C-c C-.</kbd> | Jump to some namespace on the classpath.
457+
<kbd>C-c M-t v</kbd> | Toggle var tracing.
458+
<kbd>C-c M-t n</kbd> | Toggle namespace tracing.
459+
<kbd>C-c C-q</kbd> | Quit the current nREPL connection. With a prefix argument it will quit all connections.
460+
461+
There's no need to memorize this list. In any REPL buffer you'll have a `REPL`
462+
menu available, which lists all the most important commands and their
463+
keybindings. You can also invoke `C-h f RET cider-repl-mode` to get a list of the
464+
keybindings for `cider-repl-mode`.
465+
466+
In the REPL you can also use "shortcut commands" by pressing `,` at the
467+
beginning of a REPL line. You'll be presented with a list of commands you can
468+
quickly run (like quitting, displaying some info, clearing the REPL, etc). The
469+
character used to trigger the shortcuts is configurable via
470+
`cider-repl-shortcut-dispatch-char`. Here's how you can change it to `:`:
471+
472+
```el
473+
(setq cider-repl-shortcut-dispatch-char ?\:)
474+
```
475+
420476
### ClojureScript usage
421477

422478
ClojureScript support relies on the
@@ -480,52 +536,6 @@ While you're in `clojure-mode`, `cider-jack-in` is bound for
480536
convenience to <kbd>C-c M-j</kbd> and `cider-connect` is bound to <kbd>C-c
481537
M-c</kbd>.
482538

483-
### cider-repl-mode
484-
485-
Keyboard shortcut | Description
486-
-------------------------------------|------------------------------
487-
<kbd>RET</kbd> | Evaluate the current input in Clojure if it is complete. If incomplete, open a new line and indent. If invoked with a prefix argument is given then the input is evaluated without checking for completeness.
488-
<kbd>C-RET</kbd> | Close any unmatched parenthesis and then evaluate the current input in Clojure.
489-
<kbd>C-j</kbd> | Open a new line and indent.
490-
<kbd>C-c C-o</kbd> | 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.
491-
<kbd>C-c M-o</kbd> | Switch between the Clojure and ClojureScript REPLs for the current project.
492-
<kbd>C-c C-u</kbd> | Kill all text from the prompt to the current point.
493-
<kbd>C-c C-b</kbd> <kbd>C-c C-c</kbd>| Interrupt any pending evaluations.
494-
<kbd>C-up</kbd> <kbd>C-down</kbd> | Goto to previous/next input in history.
495-
<kbd>M-p</kbd> <kbd>M-n</kbd> | Search the previous/next item in history using the current input as search pattern. If <kbd>M-p/M-n</kbd> is typed two times in a row, the second invocation uses the same search pattern (even if the current input has changed).
496-
<kbd>M-s</kbd> <kbd>M-r</kbd> | Search forward/reverse through command history with regex.
497-
<kbd>C-c C-n</kbd> <kbd>C-c C-p</kbd> | Move between the current and previous prompts in the REPL buffer. Pressing <kbd>RET</kbd> on a line with old input copies that line to the newest prompt.
498-
<kbd>C-c C-x</kbd> | Reload all modified files on the classpath.
499-
<kbd>C-u C-c C-x</kbd> | Reload all files on the classpath.
500-
<kbd>TAB</kbd> | Complete symbol at point.
501-
<kbd>C-c C-d d</kbd> | 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
502-
<kbd>C-c C-d j</kbd> | 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.
503-
<kbd>C-c C-d r</kbd> | Lookup symbol in Grimoire.
504-
<kbd>C-c C-d a</kbd> | Apropos search for functions/vars.
505-
<kbd>C-c C-d A</kbd> | Apropos search for documentation.
506-
<kbd>C-c C-z</kbd> | Switch to the previous Clojure buffer. This complements <kbd>C-c C-z</kbd> used in cider-mode.
507-
<kbd>C-c M-i</kbd> | Inspect expression. Will act on expression at point if present.
508-
<kbd>C-c M-n</kbd> | Select a namespace and switch to it.
509-
<kbd>C-c C-.</kbd> | Jump to some namespace on the classpath.
510-
<kbd>C-c M-t v</kbd> | Toggle var tracing.
511-
<kbd>C-c M-t n</kbd> | Toggle namespace tracing.
512-
<kbd>C-c C-q</kbd> | Quit the current nREPL connection. With a prefix argument it will quit all connections.
513-
514-
There's no need to memorize this list. In any REPL buffer you'll have a `REPL`
515-
menu available, which lists all the most important commands and their
516-
keybindings. You can also invoke `C-h f RET cider-repl-mode` to get a list of the
517-
keybindings for `cider-repl-mode`.
518-
519-
In the REPL you can also use "shortcut commands" by pressing `,` at the
520-
beginning of a REPL line. You'll be presented with a list of commands you can
521-
quickly run (like quitting, displaying some info, clearing the REPL, etc). The
522-
character used to trigger the shortcuts is configurable via
523-
`cider-repl-shortcut-dispatch-char`. Here's how you can change it to `:`:
524-
525-
```el
526-
(setq cider-repl-shortcut-dispatch-char ?\:)
527-
```
528-
529539
### cider-macroexpansion-mode
530540

531541
Keyboard shortcut | Description

0 commit comments

Comments
 (0)