formatter

This commit is contained in:
Nicolas Rannou 2024-06-15 16:17:13 +02:00
parent ebd68fb74c
commit 7e10d80511

View File

@ -25,12 +25,37 @@ return { -- Autoformat
end,
formatters_by_ft = {
lua = { "stylua" },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use a sub-list to tell conform to run *until* a formatter
-- is found.
-- javascript = { { "prettierd", "prettier" } },
typescript = { { "dprint", "prettier" } },
html = { "prettier" },
css = { "prettier" },
scss = { "prettier" },
php = { "php-cs-fixer" },
-- Conform can also run multiple formatters sequentially
python = { "isort", "black" },
},
-- LazyVim will merge the options you set here with builtin formatters.
-- You can also define any custom formatters here.
---@type table<string,table>
formatters = {
injected = { options = { ignore_errors = true } },
-- # Example of using dprint only when a dprint.json file is present
dprint = {
condition = function(ctx)
return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
end,
},
prettier = {
condition = function(ctx)
return vim.fs.find({ ".prettierrc" }, { path = ctx.filename, upward = true })[1]
end,
},
--
-- Example of using shfmt with extra args
shfmt = {
extra_args = { "-i", "2", "-ci" },
},
},
},
}