summaryrefslogtreecommitdiff
path: root/fnl/plugins/conform.fnl
blob: b1b15ba7dbbf6811ca87459a2756d0891e9ebfd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; Formatting

(λ init []
  (vim.keymap.set [:n :v] :<leader>e
                  (λ []
                    (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]
                                :elixir [:mix]
                                :fennel [:fnlfmt]
                                :haskell [:fourmolu]
                                :html [:prettierd]
                                :http [:jq]
                                :json [:jq]
                                :lua [:stylua]
                                :markdown [:prettierd]
                                :ocaml [:ocamlformat]
                                :python [:ruff_format :ruff_fix :ruff_organize_imports]
                                :rust [:rustfmt]
                                :sh [:shfmt :shellharden]
                                :sql [:pg_format :sqlfmt]
                                :toml [:taplo]
                                :yaml [:yamlfmt]}})

{1 :stevearc/conform.nvim : init : opts :event [:BufReadPost :BufNewFile]}