summaryrefslogtreecommitdiff
path: root/fnl/plugins/editor/conform.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'fnl/plugins/editor/conform.fnl')
-rw-r--r--fnl/plugins/editor/conform.fnl34
1 files changed, 34 insertions, 0 deletions
diff --git a/fnl/plugins/editor/conform.fnl b/fnl/plugins/editor/conform.fnl
new file mode 100644
index 0000000..4f1b01a
--- /dev/null
+++ b/fnl/plugins/editor/conform.fnl
@@ -0,0 +1,34 @@
+;; Formatting
+
+(fn init []
+ (vim.keymap.set [:n :v] :<leader>e
+ (lambda []
+ (let [conform (require :conform)]
+ (conform.format {:lsp_fallback true :async true})))
+ {:desc :Format}))
+
+(fn config []
+ (let [conform (require :conform)]
+ (conform.setup {:formatters {:fnlfmt {:command :fnlfmt
+ :args [:--fix :$FILENAME]
+ :stdin false}}
+ :formatters_by_ft {:* [:codespell
+ :trim_whitespace
+ :trim_newlines]
+ :css [:stylelint]
+ :fennel [:fnlfmt]
+ :haskell [:fourmolu]
+ :html [:djlint]
+ :json [:jq]
+ :lua [:stylua]
+ :markdown [:cbfmt]
+ :ocaml [:ocamlformat]
+ :org [:cbfmt]
+ :python [:ruff_format]
+ :rust [:rustfmt]
+ :sh [:shfmt :shellharden]
+ :sql [:pg_format :sqlfluff]
+ :toml [:taplo]
+ :yaml [:yamlfmt]}})))
+
+{1 :stevearc/conform.nvim : init : config :event [:BufReadPost :BufNewFile]}