From 2ac26b8d7a4fdd681b2c763fe4b470f1bc97bb17 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Sat, 13 Apr 2024 16:59:57 +0200 Subject: [PATCH] FormatEnable and FormatDisable now actually works --- nvim/dot-config/nvim/lua/plugins/conform.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nvim/dot-config/nvim/lua/plugins/conform.lua b/nvim/dot-config/nvim/lua/plugins/conform.lua index fab89d4..659236c 100644 --- a/nvim/dot-config/nvim/lua/plugins/conform.lua +++ b/nvim/dot-config/nvim/lua/plugins/conform.lua @@ -35,9 +35,12 @@ return { -- ["*"] = { "codespell" }, ["_"] = { "trim_whitespace", "trim_newlines" }, }, - format_after_save = { - lsp_fallback = true, - }, + format_after_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { lsp_fallback = true } + end, notify_on_error = true, }, init = function()