The idea of interactive programming is at the very heart of CIDER. Programmers are expected to program in a very dynamic and incremental manner, constantly re-evaluating existing Clojure definitions and adding new ones to their running applications. You never stop/start a Clojure application while using CIDER - you're constantly interacting with it and changing it. CIDER comes with a handy minor mode called `cider-mode` (complementing `clojure-mode`) that allows you to evaluate code in your Clojure source files and load it directly in the REPL. `cider-mode` is the primary way you're supposed to be interacting with your REPL process. If you want to get productive with CIDER, you'll have to get intimately familiar with it. ## Using cider-mode Here's a list of `cider-mode`'s keybindings: Command | Keyboard shortcut | Description ----------------------------------------------|-------------------------------------|------------------------------- `cider-eval-last-sexp` |C-x C-e
C-c C-e| Evaluate the form preceding point and display the result in the echo area and/or in an buffer overlay (according to `cider-use-overlays`). If invoked with a prefix argument, insert the result into the current buffer. `cider-eval-last-sexp-and-replace` |C-c C-v w | Evaluate the form preceding point and replace it with its result. `cider-eval-last-sexp-to-repl` |C-c M-e | Evaluate the form preceding point and output it result to the REPL buffer. If invoked with a prefix argument, takes you to the REPL buffer after being invoked. `cider-insert-last-sexp-in-repl` |C-c M-p | Load the form preceding point in the REPL buffer. `cider-pprint-eval-last-sexp` |C-c C-v C-f e | Evaluate the form preceding point and pretty-print the result in a popup buffer. If invoked with a prefix argument, insert the result into the current buffer as a comment. `cider-pprint-eval-defun-at-point` |C-c C-v C-f d | Evaluate the top level form under point and pretty-print the result in a popup buffer. If invoked with a prefix argument, insert the result into the current buffer as a comment. `cider-eval-defun-at-point` |C-M-x
C-c C-c | Evaluate the top level form under point and display the result in the echo area. `cider-eval-sexp-at-point` |C-c C-v v | Evaluate the form around point. `cider-eval-defun-at-point` |C-u C-M-x
C-u C-c C-c | Debug the top level form under point and walk through its evaluation `cider-eval-defun-up-to-point` |C-c C-v z | Evaluate the preceding top-level form up to the point. `cider-eval-region` |C-c C-v r | Evaluate the region and display the result in the echo area. `cider-interrupt` |C-c C-b | Interrupt any pending evaluations. `cider-macroexpand-1` |C-c C-m | Invoke `macroexpand-1` on the form at point and display the result in a macroexpansion buffer. If invoked with a prefix argument, `macroexpand` is used instead of `macroexpand-1`. `cider-macroexpand-all` |C-c M-m | Invoke `clojure.walk/macroexpand-all` on the form at point and display the result in a macroexpansion buffer. `cider-eval-ns-form` |C-c C-v n | Eval the ns form. `cider-repl-set-ns` |C-c M-n (M-)n | Switch the namespace of the REPL buffer to the namespace of the current buffer. `cider-switch-to-repl-buffer` |C-c C-z | Switch to the relevant REPL buffer. Use a prefix argument to change the namespace of the REPL buffer to match the currently visited source file. `cider-switch-to-repl-buffer` |C-u C-u C-c C-z | Switch to the REPL buffer based on a user prompt for a directory. `cider-load-buffer-and-switch-to-repl-buffer` |C-c M-z | Load (eval) the current buffer and switch to the relevant REPL buffer. Use a prefix argument to change the namespace of the REPL buffer to match the currently visited source file. `cider-describe-current-connection` |C-c M-d | Display default REPL connection details, including project directory name, buffer namespace, host and port. `cider-find-and-clear-repl-output` |C-c C-o | Clear the last output in the REPL buffer. With a prefix argument it will clear the entire REPL buffer, leaving only a prompt. Useful if you're running the REPL buffer in a side by side buffer. `cider-load-buffer` |C-c C-k | Load (eval) the current buffer. `cider-load-file` |C-c C-l | Load (eval) a Clojure file. `cider-load-all-files` |C-c C-M-l | Load (eval) all Clojure files below a directory. `cider-ns-refresh` |C-c M-n (M-)r | Reload all modified files on the classpath. If invoked with a prefix argument, reload all files on the classpath. If invoked with a double prefix argument, clear the state of the namespace tracker before reloading. `cider-doc` |C-c C-d d
C-c C-d C-d | Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol. `cider-javadoc` |C-c C-d j
C-c C-d C-j | Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol. `cider-grimoire` |C-c C-d r
C-c C-d C-r | Lookup symbol in Grimoire. `cider-grimoire-web` |C-c C-d w
C-c C-d C-w | Open the grimoire documentation for symbol in a web browser. `cider-apropos` |C-c C-d a
C-c C-d C-a | Apropos search for functions/vars. `cider-apropos-documentation` |C-c C-d f
C-c C-d C-f | Apropos search for documentation. `cider-apropos-documentation-select` |C-c C-d e
C-c C-d C-e | Apropos search for documentation & select. `cider-inspect` |C-c M-i | Inspect expression. Will act on expression at point if present. `cider-toggle-trace-var` |C-c M-t v | Toggle var tracing. `cider-toggle-trace-ns` |C-c M-t n | Toggle namespace tracing. `cider-undef` |C-c C-u | Undefine a symbol. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol. `cider-test-run-test` |C-c C-t t
C-c C-t C-t | Run test at point. `cider-test-rerun-test` |C-c C-t g
C-c C-t C-g | Re-run the last test you ran. `cider-test-run-ns-tests` |C-c C-t n
C-c C-t C-n | Run tests for current namespace. `cider-test-run-loaded-tests` |C-c C-t l
C-c C-t C-l | Run tests for all loaded namespaces. `cider-test-run-project-tests` |C-c C-t p
C-c C-t C-p | Run tests for all project namespaces. This loads the additional namespaces. `cider-test-rerun-failed-tests` |C-c C-t r
C-c C-t C-r | Re-run test failures/errors. `cider-test-show-report` |C-c C-t b
C-c C-t C-b | Show the test report buffer. `cider-find-var` |M-. | Jump to the definition of a symbol. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol. `cider-find-dwim-at-mouse` |mouse-5 or mouse-9 | Jump to the definition of a symbol using mouse. `xref-pop-marker-stack` |mouse-4 or mouse-8 | Jump back to where `cider-find-dwim-at-mouse` was invoked. `cider-find-resource` |C-c M-. | Jump to the resource referenced by the string at point. `cider-find-ns` |C-c C-. | Jump to some namespace on the classpath. `cider-pop-back` |M-, | Return to your pre-jump location. `complete-symbol` |M-TAB | Complete the symbol at point. `cider-quit` |C-c C-q | Quit the current nREPL connection. !!! Tip There's no need to memorize this list. In any Clojure buffer with `cider-mode` active you'll have a CIDER menu available, which lists all the most important commands and their keybindings. You can also invoke `C-h f RET cider-mode` to get a list of the keybindings for `cider-mode`. ![CIDER interactions menu](images/menu_example.png) !!! Tip An even better solution would be to install [which-key][], which will automatically show you a list of available keybindings as you start typing some keys. This will simplify your interactions with CIDER quite a lot (especially in the beginning). Here's what you'd see if you typed C-c C-d in a Clojure buffer: ![CIDER which-key](images/cider-which-key.png) [which-key]: https://github.com/justbur/emacs-which-key