A nice place to call home
hearth is a collection of utilities for Vim-based Clojure development that originated in my dot files. It's still highly in flux, and as a result some assumptions may not hold for all users, but feel free to submit a PR if you find something that leans too hard on my own vimrc.
Required dependencies:
Optional (encouraged) dependencies:
- ale: we provide some extra async linting and fixits
- vim-mantel: for async semantic highlighting
- fzf: for choosing between candidates for auto-import
- refactor-nrepl: can improve auto import
- cider-nrepl: is considered required for fireplace anyway
Features:
- Auto-require namespaces, asynchronously
- Auto template filling for new files
- Add indication for syntax errors that clj-kondo doesn't catch
- Improved test-running tools (including support for Clojurescript)
- Simplified Fireplace REPL connection
- ALE fixer for missing
:require
forms - ALE fixer for
symbol already refers to something
errors
Install with your favorite plugin manager. I like Plug:
Plug 'dhleong/vim-hearth'
Plug 'tpope/vim-fireplace'
To get linting and fixits, you'll need ale. Linting should come for free
when you save the file, as long as you don't disable auto-reloading. To fix
the issues we find, you'll need to enable the hearth
fixer:
let g:ale_fixers = {
\ 'clojure': ['hearth'],
\ }
hearth creates a cpt
mapping that runs the associated test for the current
namespace, and works for both clojure and clojurescript tests, handling
both Figwheel and shadow-cljs.
hearth creates a glc
mapping ("go lein connect") that attempts to determine
the repl port, etc. using a handful of different strategies to support
Figwheel and shadow-cljs, as necessary.