Connect to a Clojure REPL
Starting a REPL in a terminal is the most resilient way of running a REPL, as if the editor has to be restarted or crashes, the REPL is not affected.
practicalli/clojure-deps-edn provides many aliases to configure a REPL to work with other community tools (e.g. data ). These aliases are easier to manage when running a REPL outside of an editor which automatically injects its own configuration.
Start a REPL in the terminal
clojure command and
clj wrapper both start a REPL with a simple terminal interface,
clj also provides command history.
practicalli/clojure-deps-edn defines the
:middleware/clj alias that includes several libraries required for the nREPL connection between CIDER and the REPL.
Open a terminal in the root directory of a Clojure project and run a non-interactive REPL process
The REPL will start along with an nREPL server, showing the connection details.
.nrepl-port file is created in the root of the Clojure project, containing the port number the nREPL server is listening upon.
Using the REPL terminal UI
For a rich terminal REPL experience, start the REPL with rebel readline as well as nREPL and CIDER libraries.
Connect to REPL from CIDER
SPC f f to open a file from the Clojure project on the remote server.
, ' to call
sesman-start and choose
cider-connect-clj which should find the right host and port
Confirm the host name, typically
localhost when running the REPL locally
Confirm the port number the nREPL server is listening too
Spacemacs is now connected to the REPL and Clojure code can be evaluated in the source code buffers.
Common REPL start / restart keybindings
||start a REPL, selecting the type (
||browse active REPL's (
||show information about the current REPL (
||restart the REPL, quit and jack-in. (
||quit the REPL (
||refresh stale code and load new code into the REPL (
||force reload the current namespaces in the REPL (