vim

2023-01-03T16:50:40.334989Z

I've been happily using the indentation-fixing command of vim-sexp for years, but its lack of configuration is letting me down in a specific, slightly nonstandard case. Metabase's style is to use a single space indent in vertically stacked (lists), like for [vectors] and {maps}. so for example we want an ns to look like

(ns metabase.shared.util.log
  (:require
   [goog.log :as glog]
   ; ...
   [lambdaisland.glogi.console :as glogi-console])
  (:require-macros
   [metabase.shared.util.log]))
but if I use == and friends from vim-sexp the :require lines get indented by two spaces:
(ns metabase.shared.util.log
  (:require
    [goog.log :as glog]
    ; ...
    [lambdaisland.glogi.console :as glogi-console])
  (:require-macros
    [metabase.shared.util.log]))
I can shell out to cljfmt to fix it, but that's slow and clunky. I use Conjure and nREPL. (I know vim-iced has some more powerful indentation through cider-refactor. I may have to look into that, but I moved away from vim-iced to straight Conjure when I was having REPL-juggling issues last year.) are there any nicer ways to get configurable Clojure indentation?

dominicm 2023-01-11T14:50:58.875999Z

https://github.com/guns/vim-clojure-static#gclojure_align_subforms I think you're looking for this

practicalli-johnny 2023-01-03T17:23:05.956639Z

I use clojure-lsp format as I type and use https://github.com/greglook/cljstyle in the terminal before committing, cljstyle is very snappy as its a binary and also available in the https://github.com/DeLaGuardo/setup-clojure. https://github.com/practicalli/clojure-app-template/blob/main/.cljstyle. Its very similar to cljfmt in rules, but I find the configuration far easier to understand.

👆 1
2023-01-03T17:03:22.764879Z

My company's codebase is similar tho we use zprint. I've taken to just letting the indentation be wrong while I develop, and then calling our binstub bin/zprint-changed to format all touched files before committing