Skip to content

Commit 31af2db

Browse files
katomusobbatsov
authored andcommitted
Add a section on cheatsheet to the docs
1 parent 78e4a1c commit 31af2db

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed
Loading
Loading
Loading
Loading

doc/modules/ROOT/pages/usage/misc_features.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,23 @@ If you would prefer for it to have a lower precedence, you can change `cider-xre
329329
----
330330

331331
TIP: See https://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Hooks.html[Setting Hooks] for more information about depth.
332+
333+
== Cheatsheet
334+
335+
There are two ways to access https://clojure.org/api/cheatsheet[Clojure cheatsheet] in CIDER.
336+
337+
The first one is available through `cider-cheatsheet` command and displays the cheatsheet in a popup buffer. This is how it looks with two windows displaying the cheatsheet buffer side by side:
338+
339+
image::cider-cheatsheet.png[Displaying cheatsheet in buffer]
340+
341+
The second way is available through `cider-cheatsheet-select` command, which uses completions in the minibuffer to find a var in the cheatsheet. By default, it provides a multi-step selection process where you need to go section by section until you find a var. This is how it looks in the minibuffer:
342+
343+
image::cider-cheatsheet-select-1.png[Selecting section in cheatsheet]
344+
345+
image::cider-cheatsheet-select-2.png[Selecting var in cheatsheet]
346+
347+
By using a prefix argument when calling `cider-cheatsheet-select`, we can change the behavior of `cider-cheatsheet-select` so each candidate is represented as a full path to a var. This can be useful with fuzzy completion style and vertical candidates display, as in that case, we can search in any element of the path, possibly getting matches from multiple categories at the same time. This is how it looks with such a workflow:
348+
349+
image::cider-cheatsheet-select-3.png[Selecting path in cheatsheet]
350+
351+
It is possible to control which function is used on a var when it is selected by customizing `cider-cheatsheet-default-action-function`. By default, documentation for a var is displayed using `cider-doc-lookup`, but it can also be set to `cider-clojuredocs-lookup` to show documentation from ClojureDocs or any other function accepting a var as an argument.

0 commit comments

Comments
 (0)