From 665e83b6dcbf94efe90dabb3d0b8867ccbb61c88 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 18 Jan 2024 05:59:17 -0600 Subject: [PATCH] fix(nvim): correctly close the alpha timer for dashboard --- dots/.config/nvim/lua/plugins/configs/alpha.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/alpha.lua b/dots/.config/nvim/lua/plugins/configs/alpha.lua index b0803099..22113ffc 100644 --- a/dots/.config/nvim/lua/plugins/configs/alpha.lua +++ b/dots/.config/nvim/lua/plugins/configs/alpha.lua @@ -183,7 +183,12 @@ return { 50, 1000, vim.schedule_wrap(function() - vim.cmd("AlphaRedraw") + ---@diagnostic disable-next-line: param-type-mismatch + local success, _ = pcall(vim.cmd, "AlphaRedraw") + if not success and not alpha_timer:is_closing() then + vim.api.nvim_del_autocmd(args.id) + alpha_timer:close() + end end) ) @@ -192,8 +197,10 @@ return { desc = "Shut down alpha timer", callback = function() ---@diagnostic disable-next-line: need-check-nil - alpha_timer:close() - vim.api.nvim_del_autocmd(args.id) + if not alpha_timer:is_closing() then + alpha_timer:close() + vim.api.nvim_del_autocmd(args.id) + end return true end, })