Skip to content

Commit

Permalink
format: clojure-cli repl section and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalli-johnny committed Mar 6, 2024
1 parent 926a413 commit 2a7b037
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Unreleased
## Changed
- clojure-cli: enhance built-in commands description
- code-challenge: rewrite code challenges overview
- code-challenge: rewrite code challenges overview
- dev: code block consistent style lint rules 46 & 48
- mkdocs: clojure-idiom admonition style
- dev: gitleaks rules configuration for checking secrets in megalinter workflow
Expand All @@ -29,7 +29,7 @@
- dev: changelog-check remove paths-ignore
- clojure-cli: install deps.edn configuration
- clojure-cli: `clojure -X:deps tree` examples
- clojure-cli: `clojure -X:deps pom`
- clojure-cli: `clojure -X:deps pom`
- install: debian packages approach for OpenJDK rather than a specific Ubuntu tab
- install: recommended OpenJDK versions of 17 and 21 as hint
- editor: refactor Clojure LSP page and format for Material for MkDocs
Expand All @@ -43,7 +43,7 @@
- dev: sparse checkout scheduled version workflow
- dev: upload-artefact v4 & remove explicit token from megalinter
- format: use shell for code blocks, add missing clojure language to code blocks
- dev: megalinter local runner - validate all files
- dev: megalinter local runner - validate all files
- dev: spell lychee config file for megalinter config set as warnings
- dev: extend lychee exclusion rules and base url
- dev: allow `a` and `img` html elements in markdown linter
Expand Down
9 changes: 4 additions & 5 deletions docs/clojure-cli/repl/coding.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Clojure code can be typed into the REPL directly and the result instantly returned. Code can also be loaded from a project source code files, to run pre-written code.

??? HINT "Clojure Editors are the main tool for writing code"
An [editor connected to a Clojure REPL](/clojure-editors/) and evaluating from source code files is the most effective way for writing Clojure code.
An [editor connected to a Clojure REPL](/clojure/clojure-editors/) and evaluating from source code files is the most effective way for writing Clojure code.

Evaluating code in an editor automatically uses the correct namespace, avoiding the need to change namespaces or fully qualify function calls. Evaluation results can be shown in-line, as comments next to the code or in a data inspector.
Evaluating code in an editor automatically uses the correct namespace, avoiding the need to change namespaces or fully qualify function calls. Evaluation results can be shown in-line, as comments next to the code or in a data inspector.

Editors provide structural editing and Clojure syntax checking, along with general editor features. and
Editors provide structural editing and Clojure syntax checking, along with general editor features.


## Using the REPL
## Using the REPL

Use the `clojure` command to start a REPL with Rebel, or the `clj` wrapper with the Clojure CLI REPL ([requires `rlwrap` binary](/clojure/install/clojure-cli/#optional-rlwrap-readline)).

Expand Down Expand Up @@ -137,4 +137,3 @@ Use the `:verbose` option when issues occur loading a particular namespace. As
## Next steps

[Managing Library dependencies in REPL](libraries.md){.md-button}

28 changes: 15 additions & 13 deletions docs/clojure-cli/repl/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ Moving the cursor after the name of a function will show the signatures availabl

> `clojure.repl/doc` function also shows the docstring of a function `(clojure.repl/doc doc)`
++ctrl+c+ctrl+"a"++ on a name shows all the possible matching functions to help you discover what is available. ++tab++ through the list of matches, ++enter++ to select a function
++ctrl+x++ ++ctrl+"a"++ on a name shows all the possible matching functions to help you discover what is available. ++tab++ through the list of matches, ++enter++ to select a function

![clojure repl rebel - apropos on function showing all variations](https://github.com/practicalli/graphic-design/blob/live/clojure/rebel/clojure-repl-rebel-function-apropos-map-dark.png?raw=true)
![clojure repl rebel - apropos on function showing all variations](https://github.com/practicalli/graphic-design/blob/live/clojure/rebel/clojure-repl-rebel-function-apropos-map-dark.png?raw=true#only-dark)
![clojure repl rebel - apropos on function showing all variations](https://github.com/practicalli/graphic-design/blob/live/clojure/rebel/clojure-repl-rebel-function-apropos-map-light.png?raw=true#only-light)


## Rebel Commands

Type `:repl/help` or `:repl` TAB to see a list of available commands.
Type `:repl/help` or `:repl` followed by ++tab++ to see a list of available commands.

| Keybinding | Description |
|---------------------------|-------------------------------------------------------------------|
|-------------------------- | ----------------------------------------------------------------- |
| `:repl/help` | Prints the documentation for all available commands. |
| `:repl/key-bindings` | search or list current key bindings |
| `:repl/quit` | Quits the REPL |
Expand All @@ -44,16 +45,17 @@ Type `:repl/help` or `:repl` TAB to see a list of available commands.
| `:repl/toggle-highlight` | Toggle readline syntax highlighting on and off |
| `:repl/toggle-indent` | Toggle the automatic indenting of Clojure code on and off |


## Key-bindings

| Keybinding | Description |
|-----------------|-------------------------------------------------------------------------------|
| `Ctrl-C` | aborts editing the current line |
| `Ctrl-D` | at the start of a line => sends an end of stream message |
| `TAB` | word completion or code indent when cursor in whitespace at the start of line |
| `Ctrl-X_Ctrl-D` | Show documentation for word at point |
| `Ctrl-X_Ctrl-S` | Show source for word at point |
| `Ctrl-X_Ctrl-A` | Show apropos for word at point |
| `Ctrl-X_Ctrl-E` | Inline eval for SEXP before the point |
| Keybinding | Description |
| ------------------------- | ------------------------------------------------------------------------------- |
| ++ctrl+"c"++ | aborts editing the current line |
| ++ctrl+"d"++ | at the start of a line => sends an end of stream message |
| ++tab++ | word completion or code indent when cursor in whitespace at the start of line |
| ++ctrl+"x"++ ++ctrl+"d"++ | Show documentation for word at point |
| ++ctrl+"x"++ ++ctrl+"s"++ | Show source for word at point |
| ++ctrl+"x"++ ++ctrl+"a"++ | Show apropos for word at point |
| ++ctrl+"x"++ ++ctrl+"e"++ | Inline eval for SEXP before the point |

Examine key-bindings with the `:repl/key-bindings` command.

0 comments on commit 2a7b037

Please sign in to comment.