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