Fork me on GitHub
#vim
<
2023-02-24
>
jkrasnay03:02:09

Does anyone know how to customize Clojure indentation in Vim? I’m writing some core.logic code and I would like to get run* and fresh formatting the same as let. I tried adding these to lispwords but it doesn’t help, perhaps because vim-sexp is involved, but looking at the vim-sexp source doesn’t reveal how it would indent run* and let differently.

jkrasnay03:02:51

Oh, it looks like lispwords was working, just that somehow I got shiftwidth=8. set shiftwidth=2 fixed it all up.

🎉 2
dominicm12:02:42

fwiw, you want :help clojure.txt. vim-sexp doesn’t get too involved with indentation.

👍 2
jkrasnay14:02:26

BTW :help clojure.txt didn’t seem to work for me (maybe because I’m using neovim), but :h clojure-indent had all the details. Weirdly, even though the help text said function indenting is “two spaces” it appears to indent by shiftwidth instead.

jkrasnay14:02:56

For anyone interested, :h clojure-syntax has some goodies too.

dominicm14:02:46

It might be because I've installed the more up to date version from GitHub

Proctor14:02:06

Are you using LSP at all? if so, you can set some formatting rules with clj-kondo.