nvim-config/lua/configs/conform.lua

30 lines
693 B
Lua

local options = {
formatters_by_ft = {
bash = { "shfmt" },
css = { "prettier" },
json = { "prettier" },
go = { "goimports", "gofmt" },
html = { "prettier" },
lua = { "stylua" },
markdown = { "prettier" },
sh = { "shfmt" },
yaml = { "yamlfmt" },
terraform = { "tofu_fmt" },
},
formatters = {
yamlfmt = {
prepend_args = {
"-formatter",
"include_document_start=true,retain_line_breaks=true,retain_line_breaks_single=true,max_line_length=120,scan_folded_as_literal=true,pad_line_comments=2",
},
},
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
}
require("conform").setup(options)