Fork me on GitHub
#vim
<
2021-08-11
>
orestis12:08:41

My dear colleagues are unfortunately stuck using Emacs, and they're using clojure-mode to format their code. This brings some friction as whatever I'm using to format Clojure in Vim has enough differences to create whitespace diffs all the time. Especially in namespace requires etc.

orestis12:08:28

Is there a vim plugin that deals with Clojure formatting in a way pretty similar to Emacs? I'm happy to have it even as a pre-commit hook or a on-save hook that runs things through an external process.

noisesmith17:08:41

my gordian knot solution to this stuff is to use fugitive to highlight diffs and not check in whitespace only changes this can be done without editor tooling via git add -p to fix changes interactively in the terminal

noisesmith17:08:07

in general treating the diff of any given commit as a thing you have signed your name on and making it as small and pretty and meaningful as possible goes a long way :D

❤️ 2
orestis07:09:30

Oh for sure! I found out about chunks when git came out and it was a game changer. I use it as a pre-review round. But this file is very long and sifting through it is tedious.

nbardiuk12:08:41

https://github.com/weavejester/cljfmt has a lot flexibility. I am not sure if you can make it format code exactly as emacs but I would start there.

dharrigan18:08:48

There's also zprint 🙂

☝️ 8
orestis19:08:25

Perhaps I should be asking this to the Emacs channel 🙂 I think Vim is flexible here, as I can always pipe the contents of the buffer through an external program if needed.

Noah Bogart19:08:10

You can also bind a command, so :Format calls out to an external program for example

orestis19:08:54

Which supports both zprint and cljstyle

greglook19:08:39

external tools are the way to go, because you can also integrate them into things like CI

orestis19:08:50

I've used zprint in "indent only" mode successfully in the past. But ideally whatever I'm already using to format code would be closer to what Emacs is doing. I'm curious if anyone has experience collaborating with Emacs users without this kind of trouble?

athomasoriginal23:08:43

Is anyone using nvim + iced + reveal?

athomasoriginal23:08:57

Got it. For anyone looking: iced repl --middleware=vlaaad.reveal.nrepl/middleware

👍 2