diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index c8a89745..409556d1 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -41,9 +41,15 @@ function M.number() end end -local enabled = not vim.diagnostic.is_disabled() +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" })