From fa2fc6403185faabc47741b3aa2809192870b92e Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 25 Jun 2024 00:24:59 +0200 Subject: [PATCH] fix(dashboard): load dashboard when closing lazy if needed --- lua/lazyvim/plugins/ui.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 4586bf38..a060cc65 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -357,13 +357,15 @@ return { button.key_format = " %s" end - -- close Lazy and re-open when the dashboard is ready + -- open dashboard after closing lazy if vim.o.filetype == "lazy" then - vim.cmd.close() - vim.api.nvim_create_autocmd("User", { - pattern = "DashboardLoaded", + vim.api.nvim_create_autocmd("WinClosed", { + pattern = tostring(vim.api.nvim_get_current_win()), + once = true, callback = function() - require("lazy").show() + vim.schedule(function() + vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" }) + end) end, }) end