require("lz.n").load({ { "conform.nvim", event = "BufWritePre", cmd = "ConformInfo", keys = { { "f", function() require("conform").format({ async = true, lsp_format = "fallback" }) end, mode = "", desc = "[F]ormat buffer", }, }, after = function() -- Conform's built-in oxfmt formatter searches upwards for -- node_modules/.bin/oxfmt before falling back to the wrapped binary. local oxfmt = { "oxfmt" } require("conform").setup({ notify_on_error = true, format_on_save = function(bufnr) local disable_filetypes = { c = true, cpp = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else return { timeout_ms = 500, lsp_format = "fallback", } end end, formatters_by_ft = { javascript = oxfmt, javascriptreact = oxfmt, typescript = oxfmt, typescriptreact = oxfmt, json = oxfmt, jsonc = oxfmt, css = oxfmt, scss = oxfmt, less = oxfmt, html = oxfmt, markdown = oxfmt, svelte = oxfmt, lua = { "stylua" }, python = { "ruff_fix", "ruff_format", "ruff_organize_imports" }, toml = { "taplo" }, yaml = { "yamlfmt" }, }, formatters = { stylua = { prepend_args = { "--indent-type", "Spaces", "--indent-width", "2" }, }, }, }) end, }, })