Skip to content

Instantly share code, notes, and snippets.

@mgarratt
Last active May 28, 2023 06:39
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgarratt/65b29ffd736db6cb937a30c9f83fabb7 to your computer and use it in GitHub Desktop.
Save mgarratt/65b29ffd736db6cb937a30c9f83fabb7 to your computer and use it in GitHub Desktop.
Conjure Clojure Cheatsheet

nREPL

Binding Action
<localleader>cd Disconnect from the current nREPL server.
<localleader>cf Connect to a server using the port found in any of the files specified by clojure.nrepl/connection.port-files.
<localleader>sc Clone the current nREPL session.
<localleader>sf Create a fresh session from scratch.
<localleader>sq Close the current session.
<localleader>sQ Close all sessions.
<localleader>sl List all sessions.
<localleader>sn Assume the next session in the list.
<localleader>sp Assume the previous session in the list.
<localleader>ss Prompt to select any session in the list.
<localleader>rr Refresh all changed namespaces.
<localleader>ra Refresh all namespaces, even unchanged.
<localleader>rc Clear the namespace refresh cache.

Evaluate Code

Binding Action
<localleader>ei Interrupt the oldest evaluation you have running.
<localleader>E When in visual mode, evaluate the current selection.
<localleader>E[motion] Evaluate any given motion following this mapping such as E2j to evaluate this line and the two below it.
<localleader>ee Evaluate the current form under the cursor. This is the innermost pair (ignoring those in comments or strings). g:conjure#extract#form_pairs controls the character pairs.
<localleader>er Evaluate the root form under the cursor. This is the outermost pair. Great for evaluating a function you're editing if your cursor is within a few nested forms. g:conjure#extract#form_pairs controls the character pairs.
<localleader>e! Evaluate the form under the cursor and replace it with the result of the evaluation. Using this on the form (+ 10 20) would replace the form with 30.
<localleader>em[mark] Evaluate the form under the cursor at the given
<localleader>ew Evaluate the word under the cursor, good for peeking inside vars defined in your file.
<localleader>ef Evaluate the current file from disk. This may be different to what's currently in your buffer if you haven't saved!
<localleader>eb Evaluate the current buffer contents. This may be different to what's on disk if you've edited it without saving.

Documentation & Source

Binding Action
<localleader>gd Go to the definition of the word under the cursor. Support for this may vary between languages.
<localleader>vs View the source of the symbol under the cursor.
K Look up documentation for the word under the cursor. Support for this may vary between languages.

Logging

Binding Action
<localleader>ls Open the log buffer in a new horizontal split window. The direction can be controlled with
<localleader>lv Open the log buffer in a new vertical split window. The direction can be controlled with
<localleader>lt Open the log buffer in a new tab. Great for viewing large output. Just close the window to close the tab when you're done and return to your previous layout.
<localleader>lq Close all visible log windows in your current tab. Other tabs will remain unaffected.

Output & Exceptions

Binding Action
<localleader>ve View the last exception as data.
<localleader>v1 View the most recent evaluation result.
<localleader>v2 View the 2nd most recent evaluation result.
<localleader>v3 View the 3rd most recent evaluation result.

Tests

Binding Action
<localleader>ta Run all currently loaded tests.
<localleader>tn Run all tests within this namespace.
<localleader>tN Run all tests within the alternate namespace to this one. So if you're in foo.bar that would be foo.bar-test and if you're in foo.bar-test it would be foo.bar.
<localleader>tc Run the specific test under the cursor. You can execute from anywhere in the form much like evaluating the root form under the cursor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment