Files
dotFiles/.config/nvim/lua/lilJ/plugins/conform.lua
2025-05-07 20:11:36 +05:30

34 lines
1.0 KiB
Lua

return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true }
if disable_filetypes[vim.bo[bufnr].filetype] then
return nil
else
return {
timeout_ms = 500,
lsp_format = "fallback",
}
end
end,
formatters_by_ft = {
css = { "prettier" },
go = { "gofumpt", "goimports_reviser" },
html = { "prettier" },
lua = { "stylua" },
python = { "autopep8" },
typescript = { "prettier" },
typescriptreact = { "prettier" },
},
},
}