Clojure Sublime Text Setup

The goal

A Basic REPL

Clj-Kondo integration

Parinfer

Light weight, pretty, fast editor, minimal configuration

Notes

This is a very minimal setup and probably not a good candidate for your only editing environment, but likely will pair nicely with Cursive/Emacs for more heavy weight work

What you will need

Sublime Text

Package Control

Git

Preferred for this guide

macOS

Socket

Install socket into Sublime Text 3:

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages git clone https://github.com/nasser/Socket.git

In order to connect a REPL run the following on the terminal:

clj -J-Dclojure.server.jvm="{:port 11211 :accept clojure.core.server/repl}"

This opens a socket REPL, in Sublime Text open the command palette and find Socket: New you will be prompted for the following, change the values to the following:

Host localhost

Port 11211

Protocol tcp

You should now have a REPL prompt in a new panel within Sublime Text

Very importantly check out the default key-binds here:

More details: https://github.com/nasser/Socket

CLJ Kondo

Install Kondo by going to https://github.com/borkdude/clj-kondo/releases and download the file that sounds like clj-kondo-lsp-server-2020.03.20-standalone.jar and place it inside a folder that you can use to refer to it later

Use Package Control to install sublimelsp/LSP open the Preferences > Package settings > LSP > Settings which will open LSP.sublime-settings

Paste the following inside:

{ "clients" : { "clj-kondo" : { "command" : [ "java" , "-jar" , "<directory where the new jar exists>/clj-kondo-lsp-server-2020.03.20-standalone.jar" ], "enabled" : true , "languageId" : "clojure" , "scopes" : [ "source.clojure" ], "syntaxes" : [ "Packages/Clojure/Clojure.sublime-syntax" ] } } } ​

After that open the command palette and press LSP: Enable Language Server Globally and find clj-kondo in there and this will enable static analysis for you in all Clojure scopes

Parinfer

Install the Printer package from package control via oakmac/sublime-text-parinfer after installing if it's not working try opening the command palette and running Parinfer: Enable / Toggle Mode

Bonus features

The REPL that we have is quite basic in that it's a text buffer in Sublime Text but what if we want to click into nested data? We can use an alternative GUI for our socket REPL: https://github.com/vlaaad/reveal whilst still benefiting from our key-binds like send block to REPL

Run the following command when opening a new REPL and we can use reveal immediately:

clj \ -J-Dclojure.server.repl='{:port 11211 :accept vlaaad.reveal.prepl/-main}' \ -Sdeps '{:deps {vlaaad/reveal {:mvn/version "0.1.0-ea13"}}}'

Vim keys

Using package control install NeoVintageous the vim keys work pretty well and work in the socket REPL and Parinfer, Parinfer and Vim keys don't work well together in VSCode

Arcadia

The socket plugin has Arcadia integration built in, something I struggle with when using Cursive, since the projects share authors this might be quite smooth although likely basic (I have not tried this yet)

Theming

I'm using soda-theme found on package control, with this file:

Soda Dark 3.sublime-theme inside my Sublime user folder, this themes the title bar:

x [ { "class" : "title_bar" , "fg" : [ 215 , 218 , 224 ], "bg" : [ 40 , 41 , 35 ] }, ]

The rest of can be achieved by toggling off minimap, tabs etc in the command palette, & source code pro font with ui scaling