|
1 return { |
|
2 { |
|
3 "stevearc/conform.nvim", |
|
4 opts = { |
|
5 formatters_by_ft = { |
|
6 lua = { "stylua" }, |
|
7 mail = { "pandoc_markdown" }, |
|
8 markdown = { "pandoc_markdown" }, |
|
9 perl = { "perltidy" }, |
|
10 ruby = { { "standardrb", "rubocop" } }, |
|
11 sh = { "shfmt" }, |
|
12 sql = { "pg_format" }, |
|
13 -- LSP-handled: |
|
14 -- elixir = { "mix" }, |
|
15 -- go = { "goimports", "gofumpt" }, |
|
16 }, |
|
17 formatters = { |
|
18 pandoc_markdown = { |
|
19 command = "pandoc", |
|
20 args = { "-f", "markdown", "-t", "markdown" }, |
|
21 stdin = true, |
|
22 }, |
|
23 shfmt = { |
|
24 prepend_args = function(_, ctx) |
|
25 return { "-i", vim.bo[ctx.buf].shiftwidth } |
|
26 end, |
|
27 }, |
|
28 perltidy = { |
|
29 prepend_args = function(_, ctx) |
|
30 return { "-i", vim.bo[ctx.buf].shiftwidth } |
|
31 end, |
|
32 }, |
|
33 }, |
|
34 format_on_save = function(bufnr) |
|
35 local autoformat_filetypes = { "elixir", "go" } |
|
36 |
|
37 if not vim.tbl_contains(autoformat_filetypes, vim.bo[bufnr].filetype) then |
|
38 return |
|
39 end |
|
40 |
|
41 return { |
|
42 timeout_ms = 500, |
|
43 lsp_fallback = true, |
|
44 } |
|
45 end |
|
46 }, |
|
47 }, |
|
48 } |