39 lines
829 B
Lua
39 lines
829 B
Lua
return {
|
|
"stevearc/conform.nvim",
|
|
lazy = true,
|
|
cmd = "ConformInfo",
|
|
keys = {
|
|
{
|
|
"<leader>ff",
|
|
function() require("conform").format() end,
|
|
mode = { "n", "v" },
|
|
desc = "Use Conform to format current buffer",
|
|
},
|
|
},
|
|
opts = {
|
|
default_format_opts = {
|
|
timeout_ms = 3000,
|
|
async = false,
|
|
quiet = false,
|
|
lsp_format = "fallback",
|
|
},
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
python = { "black" },
|
|
rust = { "rustfmt" },
|
|
javascript = { "prettier", stop_after_first = true },
|
|
sh = { "shfmt" },
|
|
xml = { "xmlformat" },
|
|
},
|
|
format_on_save = { timeout_ms = 500, lsp_format = "fallback" },
|
|
},
|
|
config = function(_, opts)
|
|
local conform = require("conform")
|
|
conform.setup(opts)
|
|
|
|
conform.formatters.stylua = {
|
|
prepend_args = { "--collapse-simple-statement", "Always" },
|
|
}
|
|
end,
|
|
}
|