From 280055248661a4fc7b692db2d5ee80a465ebb577 Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Tue, 17 Oct 2023 10:54:51 -0400 Subject: feat: zprint formatter for clojure (#146) --- README.md | 1 + lua/conform/formatters/zprint.lua | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 lua/conform/formatters/zprint.lua diff --git a/README.md b/README.md index baea89d..bd535f0 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 0000000..935a485 --- /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, +} -- cgit v1.2.3-70-g09d2