1
0
Fork 0
neovim-config/lua/plugins/conform.lua

38 lines
676 B
Lua
Raw Normal View History

2024-09-19 12:58:41 -03:00
return {
{
"stevearc/conform.nvim",
lazy = true,
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<F3>",
function()
require("conform").format({ async = true })
end,
mode = "",
desc = "Format buffer",
},
},
opts = {
formatters_by_ft = {
kdl = { "kdlfmt" },
terraform = { "terraform_fmt" },
2024-09-19 12:58:41 -03:00
},
default_format_opts = {
lsp_format = "fallback",
},
format_on_save = { timeout_ms = 500 },
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
},
init = function()
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
},
}