Files
dotfiles/nvim/.config/nvim/lua/vxclutch/lazy/format.lua
2024-12-16 17:13:36 -05:00

31 lines
575 B
Lua

return {
"stevearc/conform.nvim",
dependencies = {
"tpope/vim-sleuth"
},
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>f",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
local disable_filetypes = { c = true, cpp = true }
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
}
end,
formatters_by_ft = {
lua = { "stylua" },
},
},
}