nvim1/lua/plugins/conform.lua

33 lines
687 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" },
},
formatters = { injected = { options = { ignore_errors = true } } },
format_on_save = { timeout_ms = 500, lsp_format = "fallback" },
},
}