Files
nvim/lua/plugins/format.lua
2024-03-26 22:03:40 +01:00

21 lines
577 B
Lua

return {
'stevearc/conform.nvim',
opts = {
notify_on_error = true,
format_on_save = function(bufnr)
local disable_filetypes = { c = true, cpp = true }
return {
timeout_ms = 1000,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
}
end,
formatters_by_ft = {
lua = { 'stylua' },
javascript = { { 'eslint_d', 'prettier' } },
javascriptreact = { { 'eslint_d', 'prettier' } },
typescript = { { 'eslint_d', 'prettier' } },
typescriptreact = { { 'eslint_d', 'prettier' } },
},
},
}