diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-12-04 22:20:46 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-12-04 22:20:46 +0100 |
commit | b96571d104ab72d95c41ffc120afa260dd280934 (patch) | |
tree | 5cd8be3110f07a3a7e02121703f52f8ab3da1554 /fnl/plugins/editor/conform.fnl | |
parent | 3df5dfb5fe0d05005f9216421444695a9acae9b4 (diff) |
Replace null(none)-ls with conform and nvim-lint
Diffstat (limited to 'fnl/plugins/editor/conform.fnl')
-rw-r--r-- | fnl/plugins/editor/conform.fnl | 34 |
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]} |