Evaluating Clojureλ︎
Practicalli recommends evaluating Clojure expressions in the source code buffer, which displays the results next to the expression until you move the cursor.
, e f evaluates the top-level expression at cursor.
, e p f evaluates the top-level expression at cursor and pretty prints the result in a separate buffer. Useful for results that are collections and nested collections. Use the cider inspector for large data sets.
, ++semi-colon++ evaluates the top-level expression at cursor and add the result as a comment. Useful for a design journal and when exploring a code base.
Review the evaluating expressions page for more examples and a deeper explanation.
Pretty Print resultsλ︎
Pretty Print is a common term for displaying code and evaluation results in an expanded structure that is easier to read. Nested data structures and other larger results from evaluation may not be so easily read by a human.
, e p e displays the evaluation result from evaluating the last s-expression in a separate popup buffer window
, e p f is the same, but for the top level expression
, e p ++semi-colon++ and , e p ++semi-colon++ pretty print results as a comment under the evaluated form.
Displaying large results
, e p f or , e p e pretty prints the results into a new buffer. This is excellent for evaluating expressions that return a large result, eg. a large map. Keep the Cider Inspector buffer open to see the results of further evaluation commands, until the inspector buffer is closed.
, d v the cider-inspector
is a great way to navigate through a large data structure, especially if it is nested.
Quick referenceλ︎
, e menu provides many different ways of evaluating parts of an expression, or a complete expression. Meta+Enter e in holy mode.
Evil Normal | Description |
---|---|
, e ++semi-colon++ | Evaluate the current expression and print the result as a comment |
, e b | Evaluate all the code in the current buffer |
, e e | Evaluate the previous expression and print the result |
, e f | Evaluate the current expression and print the result |
, e p ++semi-colon++ | Pretty print result of the top-level expression as comment |
, e p : | Pretty print result of the top-level expression as comment |
, e p f | Pretty print result of the top-level expression in a new buffer |
, e p e | Pretty print result of the last expression in a new buffer |
, e r | Evaluate code within the highlighted region |
, e w | Evaluate the previous expression and replace it with the result |
, T e | Toggle Enlighten mode, showing intermediate values |