vim

2023-02-24T03:25:09.503999Z

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.

2023-02-24T03:36:51.557749Z

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

🎉 1
dominicm 2023-02-24T12:41:42.876509Z

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

👍 1
2023-02-24T14:08:26.441349Z

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.

2023-02-24T14:08:56.447649Z

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

dominicm 2023-02-24T14:16:46.124089Z

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

2023-02-24T14:28:06.921959Z

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