liquidz / vim-iced

Clojure Interactive Development Environment for Vim8/Neovim
https://liquidz.github.io/vim-iced/
MIT License
518 stars 35 forks source link

Customizing the configuration of the internal formatter #411

Closed ghost closed 2 years ago

ghost commented 2 years ago

As the vim-iced documentation says, the following is already possible:

let g:iced#format#rule = {
      \ 'merr.core/let': '[[:block 2] [:inner 1]]',
      \ }

It would be great, if you could pass in the top configuration map for cljfmt here instead and by doing so change settings like:

{:remove-surrounding-whitespace? true
 :remove-trailing-whitespace? true
 :remove-consecutive-blank-lines? false
 :insert-missing-whitespace? true
 :remove-multiple-non-indenting-spaces? false
 ...
}

Thank you for making vim-iced πŸ’― πŸ™‡

liquidz commented 2 years ago

@ixffxi Sorry for late reaction. I've added g:iced#format#options option for customizing internal formatter(cljfmt).

Nightly document is here. https://vim-iced-nightly.netlify.app/vim-iced.html#g%3Aiced%23format%23options

Could you try dev branch?

ghost commented 2 years ago

Not at all, you have more important things to do than this. Thank you for your quick action!

I tried it and its working nicely. I fell into a little trap though: Tried it with a very minimal config and I forgot to set let g:sexp_mappings = {'sexp_indent': '', 'sexp_indent_top': ''} like it is described in "9. Formatting" With the sexp indention disabled the patch looks fine to me.

One small find in the new section of the documentation: "Default valud (<-- typo) is {}."

Thank you! πŸŽ‰

liquidz commented 2 years ago

@ixffxi Thanks for your confirmation!

One small find in the new section of the documentation: "Default valud (<-- typo) is {}."

Oh, nice catch! I've fixed, and just released v3.9.1 #415 ☺️