A couple years ago I shared a small script for experimenting with Clojure code using a Babashka nREPL and the Conjure plugin for Neovim. A newer version of Conjure creates its own Babashka nREPL, so I no longer have to spawn my own and, after Neovim exits, kill it and remove the .nrepl-port
file. With that, my earlier script can be reduced to a single command:
nvim +'set ft=clojure'
No temp file is necessary, as Conjure works in unsaved buffers.
As I wrote back in May, I've switched from writing scratch code in throwaway temp files and now save it to a directory in a timestamped file:
nvim +'set ft=clojure' $SCRATCH_FILES/$(date +"%Y-%m-%dT%H-%M-%S%z.clj")
Lately I've been writing Python for work, so I also have a quickpy
script:
nvim +'set ft=python' $SCRATCH_FILES/$(date +"%Y-%m-%dT%H-%M-%S%z.py")
With the Tree-sitter plugin for Neovim, Conjure can evaluate Python code the same way it evaluates lisp forms.
Conjure supports a variety of lisps, as well as a few non-lisps like Python. I have a handful of other quick*
scripts, such as quickfnl
for Fennel and quickhy
for Hy, but I haven't used them very much. I use Fennel for scripting Neovim and Hammerspoon, but I don't usually need scratch files for either, and I don't use Hy often enough to be fluent in it.