Skip to content

Commit 1123c58

Browse files
committed
[Docs] Reorder some REPL configuration sections
1 parent d94763f commit 1123c58

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

doc/modules/ROOT/pages/repl/configuration.adoc

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@ following:
8888
(setq cider-repl-tab-command #'indent-for-tab-command)
8989
----
9090

91+
== Customizing the `Return` key's behavior
92+
93+
Ordinarily, kbd:[Return] immediate sends a form for
94+
evaluation. If you want to insert a newline into the REPL buffer as
95+
you're editing, you can do so using kbd:[C-j]. If you are
96+
entering a lot of longer forms that span multiple lines, it may be
97+
more convenient to change the keybindings:
98+
99+
[source,lisp]
100+
----
101+
(define-key cider-repl-mode-map (kbd "RET") #'cider-repl-newline-and-indent)
102+
(define-key cider-repl-mode-map (kbd "C-<return>") #'cider-repl-return)
103+
----
104+
105+
This will make kbd:[Return] insert a newline into the REPL buffer
106+
and kbd:[C-Return] send the form off for evaluation.
107+
91108
== Auto-scrolling the REPL on Output
92109

93110
Prior to version 0.21.0, the REPL buffer would be automatically re-centered
@@ -119,6 +136,31 @@ user> (+ 1 2)
119136

120137
By default, REPL results have no prefix.
121138

139+
== Set ns in REPL
140+
141+
By default `cider-repl-set-ns` won't require the target ns, just set
142+
it. That's done with the assumption that you've probably evaluated the
143+
ns in question already before switching to it (e.g. by doing `C-c C-k`
144+
in its source file). If you want to change this behaviour (to avoid
145+
calling `cider-repl-set-ns` and then `(require 'my-ns)` manually), you
146+
can set:
147+
148+
[source,lisp]
149+
----
150+
(setq cider-repl-require-ns-on-set t)
151+
----
152+
153+
== Customizing the initial REPL namespace
154+
155+
Normally, the CIDER REPL will start in the `user` namespace. You can
156+
supply an initial namespace for REPL sessions in the `repl-options`
157+
section of your Leiningen project configuration:
158+
159+
[source,clojure]
160+
----
161+
:repl-options {:init-ns 'my-ns}
162+
----
163+
122164
== Customize the REPL Buffer's Name
123165

124166
You can customize the buffer name using the variable
@@ -212,34 +254,6 @@ for details.
212254
Alternatively, you can toggle this behaviour on and off using kbd:[M-x cider-repl-toggle-content-types]
213255
or the REPL shortcut `toggle-content-types`.
214256

215-
== Customizing the initial REPL namespace
216-
217-
Normally, the CIDER REPL will start in the `user` namespace. You can
218-
supply an initial namespace for REPL sessions in the `repl-options`
219-
section of your Leiningen project configuration:
220-
221-
[source,clojure]
222-
----
223-
:repl-options {:init-ns 'my-ns}
224-
----
225-
226-
== Customizing the `Return` key's behavior
227-
228-
Ordinarily, kbd:[Return] immediate sends a form for
229-
evaluation. If you want to insert a newline into the REPL buffer as
230-
you're editing, you can do so using kbd:[C-j]. If you are
231-
entering a lot of longer forms that span multiple lines, it may be
232-
more convenient to change the keybindings:
233-
234-
[source,lisp]
235-
----
236-
(define-key cider-repl-mode-map (kbd "RET") #'cider-repl-newline-and-indent)
237-
(define-key cider-repl-mode-map (kbd "C-<return>") #'cider-repl-return)
238-
----
239-
240-
This will make kbd:[Return] insert a newline into the REPL buffer
241-
and kbd:[C-Return] send the form off for evaluation.
242-
243257
== REPL history
244258

245259
* To make the REPL history wrap around when CIDER reaches the end:
@@ -265,17 +279,3 @@ and kbd:[C-Return] send the form off for evaluation.
265279

266280
Note that CIDER writes the history to the file when you kill the REPL
267281
buffer, which includes invoking `cider-quit`, or when you quit Emacs.
268-
269-
== Set ns in REPL
270-
271-
By default `cider-repl-set-ns` won't require the target ns, just set
272-
it. That's done with the assumption that you've probably evaluated the
273-
ns in question already before switching to it (e.g. by doing `C-c C-k`
274-
in its source file). If you want to change this behaviour (to avoid
275-
calling `cider-repl-set-ns` and then `(require 'my-ns)` manually), you
276-
can set:
277-
278-
[source,lisp]
279-
----
280-
(setq cider-repl-require-ns-on-set t)
281-
----

0 commit comments

Comments
 (0)