dotfiles/nvim/lua/plugins/conform.lua

30 lines
857 B
Lua

return {
"stevearc/conform.nvim",
keys = {
{
"<leader>cf",
function()
require("conform").format({ lsp_format = "fallback" })
end,
desc = "[C]ode [F]ormat",
},
},
opts = {
formatters_by_ft = {
lua = { "stylua" },
-- Conform will run multiple formatters sequentially
python = { "isort", "black" },
-- You can customize some of the format options for the filetype (:help conform.format)
rust = { "rustfmt" },
-- Conform will run the first available formatter
javascript = { "prettierd", "prettier", stop_after_first = true },
typescript = { "prettierd", "prettier", stop_after_first = true },
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_format = "fallback",
},
},
},
}