return { 'stevearc/conform.nvim', opts = {}, config = function() require("conform").setup({ 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", lsp_format = "fallback" }, -- Conform will run the first available formatter javascript = { "prettierd", "prettier", stop_after_first = true }, c = { "clang-format" }, cpp = { "clang-format" }, sh = { "shfmt" }, bash = { "shfmt" }, }, formatters = { ["clang-format"] = { prepend_args = { [[--style={ BasedOnStyle: LLVM, BreakBeforeBraces: Custom, BraceWrapping: { AfterFunction: true }, }]], }, }, ["rustfmt"] = { prepend_args = { "--config", "tab_spaces=2", "--config", "hard_tabs=false", }, }, }, default_format_opts = { lsp_format = "fallback", }, }) vim.keymap.set('n', 'lf', function() require("conform").format({ async = true }) end, { desc = "Format buffer" }) end }