Skip to content

Quick start: Clojure (babashka)

Roger Erens edited this page Nov 9, 2023 · 3 revisions

Babashka - A Clojure babushka for the grey areas of Bash (native fast-starting Clojure scripting environment)

Conjure supports Babashka evaluation over the native nREPL support via the Clojure client. Some parts of Conjure’s Clojure support won’t work with it since it’s not Clojure on the JVM but it’s good enough!

Prerequisites

  1. Install the latest Neovim.

  2. Install the Conjure plugin.

  3. Install babashka.

Optional: start with an nREPL server from the command line

This is actually optional as of this commit, Conjure will automatically start Babashka for you and connect to it whenever you open a Clojure file and it can’t find an existing nREPL to connect to. Babashka is the default evaluation environment for all Clojure buffers. A .nrepl-port file will automatically be created for you (and deleted after the editing session).

Starting a bb nREPL server is as simple as providing a command line argument. It won’t pick a port for you or spit it out into a .nrepl-port file for Conjure to hook into automatically though. We can use the following to pick a port and place it in a file for Conjure to read.

echo "5678" > .nrepl-port
bb --nrepl-server 5678

Open and edit!

You should now be able to open a babashka script (regular Clojure files really!) and evaluate as you normally would. You even get completions!

If you’re unsure how to evaluate things with Conjure, please refer to :help conjure, :help conjure-client-clojure-nrepl and :ConjureSchool (an interactive tutorial).