update to use conform

This commit is contained in:
kyasuda
2025-08-21 13:51:34 -07:00
parent 714e0ee2ad
commit 9fa25eaf5a
6 changed files with 92 additions and 132 deletions

View File

@@ -1,4 +1,38 @@
return {
"stevearc/conform.nvim",
opts = {},
opts = {
on_init = function(client)
require("conform").formatters.shfmt = {
append_args = { "-i", "0", "-ci", "-sr" },
}
end,
formatters_by_ft = {
python = function(bufnr)
if require("conform").get_formatter_info("ruff_format", bufnr).available then
return {
"ruff_fix",
"ruff_format",
"ruff_organize_imports",
}
else
return { "isort", "black" }
end
end,
sh = { "shfmt" },
lua = { "stylua" },
go = { "goimports", "gofmt" },
javascript = { "prettier" },
javascriptreact = { "prettier" },
typescript = { "prettier" },
typescriptreact = { "prettier" },
md = { "markdownlint" },
["*"] = { "codespell" },
["_"] = { "trim_whitespace" },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
-- lsp_format = "fallback",
},
},
}