2024-06-08 13:09:31 +00:00
|
|
|
require("conform").setup({
|
|
|
|
formatters_by_ft = {
|
|
|
|
go = { "goimports", "gofumpt" },
|
|
|
|
javascript = { "prettier" },
|
|
|
|
json = { "prettier" },
|
|
|
|
lua = { "stylua" },
|
|
|
|
markdown = { "prettier" },
|
|
|
|
python = { "isort", "black" },
|
|
|
|
typescript = { "prettier" },
|
|
|
|
yaml = { "prettier" },
|
2024-09-26 18:21:33 +00:00
|
|
|
hcl = { "terraform_fmt" },
|
2024-06-08 13:09:31 +00:00
|
|
|
},
|
|
|
|
formatters = {
|
|
|
|
{
|
|
|
|
command = "black",
|
|
|
|
args = { "--line-length", "100" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
format_on_save = function(bufnr)
|
2024-09-26 18:21:33 +00:00
|
|
|
local filetypes = { "go", "typescript", "lua", "hcl" }
|
2024-06-08 13:09:31 +00:00
|
|
|
if not vim.tbl_contains(filetypes, vim.bo[bufnr].filetype) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
return { timeout_ms = 500, lsp_fallback = false }
|
|
|
|
end,
|
|
|
|
})
|