40 lines
810 B
Lua
40 lines
810 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" },
|
|
markdown = { "dprint" },
|
|
zig = { "zigfmt" },
|
|
},
|
|
format_on_save = {
|
|
timeout_ms = 500,
|
|
lsp_fallback = true,
|
|
quiet = true,
|
|
},
|
|
},
|
|
init = function()
|
|
vim.o.formatexpr = "v:lua.require('conform').formatexpr()"
|
|
end,
|
|
},
|
|
}
|