kkinnear / zprint

Executables, uberjar, and library to beautifully format Clojure and Clojurescript source code and s-expressions.
MIT License
547 stars 46 forks source link

Vertical alignment #300

Closed radovanne3 closed 1 year ago

radovanne3 commented 1 year ago

Hello, I am interested to know if it's possible to set up vertical alignment using zprint?

kkinnear commented 1 year ago

Maybe? I don't know what you mean by vertical alignment? At some level, all indentation is "vertical alignment", and certainly zprint can do that with several different approaches. zprint will also do "justification" which will align pairs of things in columns.

Perhaps if you give me an example of a function definition and what you would like it to look like, with your desired "vertical alignment", then I can tell you if zprint can do that.

If you are referring to vertical alignment of non-code structures (say at the REPL), zprint can certainly do non-code formatting at the REPL. So if you show me some data structure formatted the way that you would like it to be formatted, I can tell you if zprint can do that for you.

I'm glad to help figure out how to configure zprint to do what you want, and frequently make additions to the code to make it even more configurable to meet peoples needs. I just need to know specifically what you are looking for.

Thanks for asking.

radovanne3 commented 1 year ago

Hey, Thanks for answer, I managed to find it in documentation. I was refering to justification. In let binding I want all values to be aligned. So in case: x --------------- "hello" second-val -- "hello" (--- reference space since it breaks in preview)

Sorry for my bad descriptions, I am relativly new at this.. And I appreciate your help.

radovanne3 commented 1 year ago

My goal is to enable zprint inside null-ls neovim plugin and to set it up so it justifies.

radovanne3 commented 1 year ago

I managed to get it done! Keep up with the good work, as far as I know, this is only formatter that enables this kind of vertical alignment! Thanks!

kkinnear commented 1 year ago

Sorry I wasn't much help with null-ls neovim, as I don't have any experience with it. But I'm fascinated that you seem to have managed to integrate zprint with null-ls neovim. Any chance you would be willing to share how you did that? I'd like to try it out myself, and if I can replicate what you did, I'd add it to the documentation for zprint. I'm sure others would like to do the same thing. Thanks!

radovanne3 commented 1 year ago

Hey, Btw I just noticed that I contacted you with two different github accounts... @ned-at-obrizum is my work related account I will share with you what I did.

I followed null-ls documentation and set zprint as wanted formatter when clojure client is active. Then I just added .zprintrc in my home dir and set dictionary with required styles inside per your documentation and it just works haha

I will provide code snippets a little bit later. :D