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 basic terminal interface,
clj also provides command history.
:repl/headless alias from practicalli/clojure-deps-edn provides a rich terminal UI and libraries required for editors to connect via nREPL (network REPL protocol).
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.
Headless terminal REPL
:repl/headless alias from practicalli/clojure-deps-edn includes libraries required for the nREPL connection between CIDER and the REPL. A headless session is useful for remote REPL processes on other servers or when interaction is only done via the editor.
Connect to REPL from CIDERλ︎
Space 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 (