diff options
Diffstat (limited to 'lua/config/packages/conform.lua')
| -rw-r--r-- | lua/config/packages/conform.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lua/config/packages/conform.lua b/lua/config/packages/conform.lua new file mode 100644 index 0000000..af59b42 --- /dev/null +++ b/lua/config/packages/conform.lua @@ -0,0 +1,23 @@ +vim.pack.add({ gh("stevearc/conform.nvim") }) + +require("conform").setup({ + default_format_opts = { lsp_format = "fallback", async = true }, + formatters_by_ft = { + rust = { "rustfmt" }, + lua = { "stylua" }, + markdown = { "prettier" }, + makefile = { "bake" }, + c = { "clang-format" }, + cpp = { "clang-format" }, + bash = { "beautysh" } + }, +}) +vim.keymap.set({ "n", "x" }, "<leader>lf", function() require("conform").format() end, { desc = "conform format" }) + +vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*", + callback = function(args) + require("conform").format({ bufnr = args.buf }) + end, +}) + |
