Skip to content

Commit

Permalink
Add a section on cheatsheet to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
katomuso committed Jun 1, 2024
1 parent 6646778 commit e39a48f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions doc/modules/ROOT/pages/usage/misc_features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,23 @@ If you would prefer for it to have a lower precedence, you can change `cider-xre
----

TIP: See https://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Hooks.html[Setting Hooks] for more information about depth.

== Cheatsheet

There are two ways to access https://clojure.org/api/cheatsheet[Clojure cheatsheet] in CIDER.

The first one is available through `cider-cheatsheet` command and displays the cheatsheet in a popup buffer. It is possible to change how the hierarchy is indented by customizing `cider-cheatsheet-indentation-function`. This is how it looks with two windows displaying the cheatsheet buffer side by side:

image::cider-cheatsheet.png[Displaying cheatsheet in buffer]

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 the var. This is how it looks in the minibuffer:

image::cider-cheatsheet-select-1.png[Selecting section in cheatsheet]

image::cider-cheatsheet-select-2.png[Selecting var in cheatsheet]

By customizing variable `cider-cheatsheet-select-path` or 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 the 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. We can change which string is used to separate elements of the path by customizing `cider-cheatsheet-select-path-separator`, but note that it can't contain characters present in elements of a path, such as `/` and `&`. This is how it looks with such a workflow:

image::cider-cheatsheet-select-3.png[Selecting path in cheatsheet]

It is also possible to control which function is used to show documentation by customizing `cider-cheatsheet-doc-function`. By default, it is set to `cider-doc-lookup` to show documentation using standard documentation facilities, but it can also be set to `cider-clojuredocs-lookup` to show documentation from ClojureDocs, or it can be set to a custom function that accepts the selected var as an argument.

0 comments on commit e39a48f

Please sign in to comment.