--- TODO: add toggle for format on save --- https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md#command-to-toggle-format-on-save --- previous keymap was uf ---@type LazySpec return { { "stevearc/conform.nvim", dependencies = { "mason.nvim" }, lazy = true, cmd = "ConformInfo", keys = { {"cf", function() require("conform").format({ async = true }) end, mode = "", desc = "Format buffer" }, { "cF", function() require("conform").format({ formatters = { "injected" }, timeout_ms = 3000 }) end, mode = { "n", "v" }, desc = "Format Injected Langs", }, }, ---@module "conform" ---@type conform.setupOpts opts = { default_format_opts = { timeout_ms = 3000, async = false, -- not recommended to change quiet = false, -- not recommended to change lsp_format = "fallback", -- not recommended to change }, formatters_by_ft = { lua = { "stylua" }, fish = { "fish_indent" }, sh = { "shfmt" }, }, -- The options you set here will be merged with the builtin formatters. -- You can also define any custom formatters here. ---@type table formatters = { injected = { options = { ignore_errors = true } }, }, }, init = function () vim.opt.formatexpr = "v:lua.require'conform'.formatexpr()" end, }, }