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

40 lines
722 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 = {
2024-10-28 00:02:57 -03:00
bash = { "shfmt" },
kdl = { "kdlfmt" },
2024-10-28 00:02:57 -03:00
sh = { "shfmt" },
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,
},
}