A terminal text editor for deep thinking. Inspired by Rich Hickey's Hammock Driven Development. Minimal C kernel. Clojure scripting. Markdown-native.
Hammock is a Clojure-oriented terminal editor inspired by Emacs, but it's not Emacs. It's built for people who think in Clojure and write in GitHub-flavored Markdown.
The *scratch* buffer runs Clojure, evaluated by
SCI
(Small Clojure Interpreter) compiled as a native shared library via GraalVM.
You can modify editor behavior live with C-j.
Two layers: a functional core in Clojure and an imperative shell in C. Commands return effect vectors describing what C should do, rather than doing it directly.
Performance-critical primitives: ncurses display,
gap buffer text storage, key input, in-process SCI calls, and cursor movement.
Everything else: commands, keybindings, modes, editor state via atoms, git integration, markdown navigation, and buffer management.
Clojure commands return data like [:message "saved"] or
[:point-forward 1]. C interprets and executes them.
Atom watches on keybindings, commands, and modes propagate changes instantly.
swap! takes effect on the next loop iteration.
ncurses terminal, input handling, gap buffers
In-process evaluation of clj/*.clj through libsci
Clojure exports EDN, C parses it into its keymap
Each keystroke dispatches through the keymap. Hot-path commands run in C for zero latency. Everything else round-trips through Clojure.
All editor commands are defined in Clojure using defcommand and return effect vectors:
;; clj/commands.clj (defcommand "save-buffer" "Save the current buffer to disk" (fn [] [(fx/save-buffer) (fx/message "Buffer saved.")])) (defcommand "git-status" "Show git status in a buffer" (fn [] (let [status (git/status)] [(fx/switch-to-buffer "*git-status*") (fx/insert status)])))
Requires a C11 compiler, ncurses, and GraalVM CE with native-image (provided by the Nix flake).