43 lines
898 B
Lua
43 lines
898 B
Lua
return {
|
|
{
|
|
"stevearc/conform.nvim",
|
|
event = { "BufWritePre" },
|
|
cmd = { "ConformInfo" },
|
|
keys = {
|
|
{
|
|
"<leader>fc",
|
|
function()
|
|
require("conform").format({ async = true, lsp_fallback = true })
|
|
end,
|
|
mode = "",
|
|
desc = "[F]ormat [C]ode inside current buffer",
|
|
},
|
|
},
|
|
opts = {
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
python = { "ruff_format" },
|
|
rust = { "rustfmt" },
|
|
html = { "prettier" },
|
|
htmldjango = { "prettier" },
|
|
css = { "prettier" },
|
|
json = { "prettier" },
|
|
scss = { "prettier" },
|
|
javascript = { "prettier" },
|
|
markdown = { "dprint" },
|
|
zig = { "zigfmt" },
|
|
toml = { "taplo" },
|
|
c = { "clang-format" },
|
|
},
|
|
format_on_save = {
|
|
timeout_ms = 500,
|
|
lsp_fallback = true,
|
|
-- quiet = true,
|
|
},
|
|
},
|
|
init = function()
|
|
vim.o.formatexpr = "v:lua.require('conform').formatexpr()"
|
|
end,
|
|
},
|
|
}
|