I need some zprint config examples


I am experimenting with using zprint as the formatting engine for Calva Formatter. I am hoping that I will be able to offer it as an option to cljfmt, which I am currently using.

Calva Formatter currently has two ”modes” of formatting. One that happens as you type and one explicit that is invoked on command (and on save, if that is enabled). The former is more relaxed and lets you keep empty lines around and such, while the latter is stricter and tidies things up more.

I am having trouble getting zprint to relax on removing newlines and I get lost in the documentation, so I’d like to have some examples, if such ones exist, my Google Fu fails me. Also general pointers from people using zprint would be nice.

I can follow up with more explicit requirements if that makes it easier to help me.

Thanks in advance!


The need for a “common sense” (~community style guide?) zprint configuration also came up in this thread:


There is a :community option in zprint, but it is still very opinionated on where to place newlines and not. Out of the box, cljfmt is much more ready to let me have my newlines where I have put them. Right or wrong, but formatting-while-typing gets weird if It refuses to enter newlines or adds and remove new-lines.

My ambitions with Calva Formatter is that it should be a contributor to a community style. But I also want it to remain an option for teams where they have different style guides. So I am planning to make Calva Formatter accept custom cljfmt configuration maps. When I saw that thread you are referring to, I realised that I should probably also support zprint and its configuration maps.

But… I will need to be able to configure any formatter I use to mainly/only do indentation and justification (zprint’s term) while the code is being typed. And I am currently not sure that I can have that with zprint.