feat(conform.lua): add support for multiple formatters for different file types to improve code formatting consistency and flexibility

This commit is contained in:
David Ibia
2024-07-29 01:02:50 +01:00
parent 3f70665f56
commit 3be2e4f344

View File

@@ -0,0 +1,14 @@
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
-- Conform will run multiple formatters sequentially
python = { "isort", "black" },
-- Use a sub-list to run only the first available formatter
javascript = { "biome" },
astro = { { "prettierd", "prettier" } },
},
})
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"