Files
nvim-config/lua/plugins/opts/conformFormat.lua

40 lines
1.1 KiB
Lua

local config = {
-- Define your formatters
formatters_by_ft = {
rust = { "rustfmt" },
lua = { "stylua" },
go = { "goimports", "gofmt" },
javascript = { "biome", "prettierd", "prettier", stop_after_first = true },
javascriptreact = { "biome", "prettierd", "prettier", stop_after_first = true },
typescript = { "biome", "prettierd", "prettier", stop_after_first = true },
typescriptreact = { "biome", "prettierd", "prettier", stop_after_first = true },
css = { "biome", "prettierd", "prettier", stop_after_first = true },
scss = { "biome", "prettierd", "prettier", stop_after_first = true },
python = {
-- To fix auto-fixable lint errors.
"ruff_fix",
-- To run the Ruff formatter.
"ruff_format",
-- To organize the imports.
"ruff_organize_imports",
},
["_"] = { "trim_whitespace" }, -- run only on filetypes without formater
-- ["*"] = { "trim_whitespace" }, -- run in all filetypes
},
format_on_save = {
timeout_ms = 500,
lsp_format = "fallback",
},
-- Customize formatters
formatters = {
ruff = {
prepend_args = { "format" },
},
shfmt = {
prepend_args = { "-i", "2" },
},
},
}
return config