return { { "stevearc/conform.nvim", config = function() local conform = require("conform") conform.setup({ formatters_by_ft = { lua = { "stylua" }, nginx = { "nginxfmt" }, yaml = { "yamlfix" }, -- Use the "*" filetype to run formatters on all filetypes. -- ["*"] = { "codespell" }, }, format_on_save = { -- Enable or disable auto-formatting on save lua = true, nginx = true, yaml = true, }, -- Set this to change the default values when calling conform.format() -- This will also affect the default values for format_on_save/format_after_save default_format_opts = { lsp_format = "fallback", }, -- If this is set, Conform will run the formatter on save. -- It will pass the table to conform.format(). -- This can also be a function that returns the table. format_on_save = { -- I recommend these options. See :help conform.format for details. lsp_format = "fallback", timeout_ms = 500, }, -- If this is set, Conform will run the formatter asynchronously after save. -- It will pass the table to conform.format(). -- This can also be a function that returns the table. format_after_save = { lsp_format = "fallback", }, -- Set the log level. Use `:ConformInfo` to see the location of the log file. log_level = vim.log.levels.ERROR, -- Conform will notify you when a formatter errors notify_on_error = true, -- Conform will notify you when no formatters are available for the buffer notify_no_formatters = true, }) vim.keymap.set({ "n", "v" }, "mp", function() conform.format({ lsp_fallback = true, async = false, timeout_ms = 500, }) end, { desc = "Format file or range (in visual mode)" }) end, }, }