This commit is contained in:
grechkagk-thinkpad 2026-02-01 16:42:22 +08:00
commit 36c66e33e6
17 changed files with 348 additions and 0 deletions

37
lua/plugins/conform.lua Normal file
View file

@ -0,0 +1,37 @@
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>f",
function()
require("conform").format({ async = true })
end,
mode = "",
desc = "Format buffer",
},
},
opts = {
formatters_by_ft = {
lua = { "stylua" },
python = { "ruff", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
},
default_format_opts = {
lsp_format = "fallback",
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true, -- современный стандарт
},
formatters = {
shfmt = {
append_args = { "-i", "2" },
},
},
},
init = function()
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}