return { { "stevearc/conform.nvim", cond = vim.g.profile == "full", event = "BufWritePre", cmd = "ConformInfo", keys = { { "lf", function() require("conform").format({ async = true, lsp_format = "fallback" }) end, desc = "Format buffer", }, { "tF", function() vim.b.disable_autoformat = not vim.b.disable_autoformat vim.notify("format on save: " .. (vim.b.disable_autoformat and "off" or "on")) end, desc = "Toggle format on save (buffer)", }, }, opts = { formatters_by_ft = { nix = { "nixfmt" }, lua = { "stylua" }, sh = { "shfmt" }, bash = { "shfmt" }, yaml = { "prettierd" }, json = { "jq" }, jsonc = { "prettierd" }, markdown = { "prettierd" }, rust = { "rustfmt" }, go = { "goimports", "gofumpt" }, javascript = { "prettierd" }, javascriptreact = { "prettierd" }, typescript = { "prettierd" }, typescriptreact = { "prettierd" }, python = { "ruff_format" }, php = { "php_cs_fixer" }, }, format_on_save = function(buf) if vim.b[buf].disable_autoformat or vim.b[buf].bigfile then return end return { timeout_ms = 1000, lsp_format = "fallback" } end, }, }, }