Skip to content

Latest commit

 

History

History
173 lines (138 loc) · 8.27 KB

README.org

File metadata and controls

173 lines (138 loc) · 8.27 KB

:lang clojure

Description

This module adds support for the Clojure(Script) language.

  • Interactive development environment (cider): REPL, compilation, debugging, running tests, definitions & documentation lookup, code completion, and much more
  • Refactoring (clj-refactor)
  • Linting (clj-kondo), requires doom-module::checkers syntax
  • LSP support (clojure-lsp), required doom-module:+lsp

Maintainers

  • @elken

Module flags

+lsp
Enable LSP support for clojure-mode (alongside Cider). Requires doom-module::tools lsp and a langserver (supports clojure-lsp).
+tree-sitter
Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.

Packages

  • doom-package:cider
  • doom-package:clj-refactor
  • doom-package:flycheck-clj-kondo if doom-module::checkers syntax

Hacks

  • Error messages emitted from CIDER are piped into the REPL buffer when it is first opened, to make them easier to notice.
  • Disabled the help banner when opening the cider REPL.

Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires:

This module optionally requires:

  • clj-kondo, for linting code (if doom-module::checkers syntax)
  • clojure-lsp, for LSP support (if doom-module:+lsp)
  • neil for the ability to add packages to your Clojure project from Emacs
  • jet for jet integration
  • cljfmt, for formatting code (if doom-module::editor format)

Usage

Below is a listing of the various keybinds provided by the module.

REPL management

For the most part, general usage should fall into:

  • Open a Clojure project
  • Open/connect to a REPL

As such, these bindings are most likely to be used.

KeybindCommand
<localleader> ’cider-jack-in-clj
<localleader> ccider-connect-clj
<localleader> Ccider-connect-cljs
<localleader> m ”cider-jack-in-cljs
<localleader> r Rcider-restart
<localleader> r qcider-quit
<localleader> r B+clojure/cider-switch-to-repl-buffer-and-switch-ns
<localleader> r Lcider-load-buffer-and-switch-to-repl-buffer
<localleader> r bcider-switch-to-repl-buffer
<localleader> r ccider-find-and-clear-repl-output
<localleader> r lcider-load-buffer
<localleader> r ncider-repl-set-ns
<localleader> r rcider-ns-refresh

Tests

The module also provides support for running tests through cider, including a nicely formatted output.

KeybindCommand
<localleader> t acider-test-rerun-test
<localleader> t lcider-test-run-loaded-tests
<localleader> t ncider-test-run-ns-tests
<localleader> t pcider-test-run-project-tests
<localleader> t rcider-test-rerun-failed-tests
<localleader> t scider-test-run-ns-tests-with-filters
<localleader> t tcider-test-run-test

Search/navigation

Some useful bindings for navigating around namespaces and symbols. When using doom-module:+lsp, the bindings in doom-module::tools lsp are supported.

KeybindCommand
<localleader> g bcider-pop-back
<localleader> g gcider-find-var
<localleader> g ncider-find-ns
<localleader> h ncider-find-ns
<localleader> n Ncider-browse-ns-all
<localleader> n ncider-browse-ns
<localleader> h acider-apropos

Evaluation

Outside of the SPC m e bindings for evaluating forms, the following are also available; including some to pretty-print the results.

KeybindCommand
<localleader> e Dcider-insert-defun-in-repl
<localleader> e Ecider-insert-last-sexp-in-repl
<localleader> e Rcider-insert-region-in-repl
<localleader> e bcider-eval-buffer
<localleader> e dcider-eval-defun-at-point
<localleader> e ecider-eval-last-sexp
<localleader> e rcider-eval-region
<localleader> p dcider-pprint-eval-defun-at-point
<localleader> p Dcider-pprint-eval-defun-to-comment
<localleader> p pcider-pprint-eval-last-sexp
<localleader> p Pcider-pprint-eval-last-sexp-to-comment
<localleader> p rcider-pprint-eval-last-sexp-to-repl

Debugging

A number of bindings to provide useful overlays that help during debugging. cider-enlighten-mode is a mode that will highlight the results of a function evaluation, including the locals. See a demo here.

KeybindCommand
<localleader> Mcider-macroexpand-all
<localleader> Rhydra-cljr-help-menu/body
<localleader> e ucider-undef
<localleader> i ecider-enlighten-mode
<localleader> i icider-inspect
<localleader> i rcider-inspect-last-result
<localleader> mcider-macroexpand-1

Help

Several bindings used for viewing documentation for various functions, both inside and outside of both a REPL and Emacs (K for example uses the sources and a cached version of clojuredocs)

KeybindCommand
<localleader> h ccider-clojuredocs
<localleader> h dcider-doc
<localleader> h jcider-javadoc
<localleader> h wcider-clojuredocs-web
K+lookup/documentation

Configuration

enrich-classpath

In recent versions, an option has been introduced that attempts to improve the experience of CIDER by accessing java source & javadocs, though this option is still currently considered beta.

In order to opt into this, add the following to your config.el

(setq cider-enrich-classpath t)

See the docs for more

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

Appendix

󱌣 This module has no appendix yet. Write one?