diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index db41c825..409556d1 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -43,7 +43,13 @@ end local enabled = true function M.diagnostics() + -- if this Neovim version supports checking if diagnostics are enabled + -- then use that for the current state + if vim.diagnostic.is_disabled then + enabled = not vim.diagnostic.is_disabled() + end enabled = not enabled + if enabled then vim.diagnostic.enable() Util.info("Enabled diagnostics", { title = "Diagnostics" })