diff --git a/README.md b/README.md index baea89d5..bd535f09 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,7 @@ You can view this list in vim with `:help conform-formatters` - [yamlfmt](https://github.com/google/yamlfmt) - yamlfmt is an extensible command line tool or library to format yaml files. - [yapf](https://github.com/google/yapf) - Yet Another Python Formatter. - [zigfmt](https://github.com/ziglang/zig) - Reformat Zig source into canonical form. +- [zprint](https://github.com/kkinnear/zprint) - Highly configurable formatter for Clojure and EDN. diff --git a/lua/conform/formatters/zprint.lua b/lua/conform/formatters/zprint.lua new file mode 100644 index 00000000..935a4852 --- /dev/null +++ b/lua/conform/formatters/zprint.lua @@ -0,0 +1,17 @@ +---@type conform.FileFormatterConfig +return { + meta = { + url = "https://github.com/kkinnear/zprint", + description = "Formatter for Clojure and EDN.", + }, + command = "zprint", + range_args = function(ctx) + return { + string.format( + "{:input {:range {:start %d :end %d :use-previous-!zprint? true :continue-after-!zprint-error? true}}}", + ctx.range.start[1] - 1, + ctx.range["end"][1] - 1 + ), + } + end, +}