From df47262f9eda929141600d2676c1f982ac5a377b Mon Sep 17 00:00:00 2001 From: Hawtian Wang Date: Tue, 28 Nov 2023 10:47:36 +0800 Subject: [PATCH] feat: load recent files after LazyVimStarted --- lua/ht/plugins/ui/alpha-nvim.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/ht/plugins/ui/alpha-nvim.lua b/lua/ht/plugins/ui/alpha-nvim.lua index b7bb557d..4fd974d9 100644 --- a/lua/ht/plugins/ui/alpha-nvim.lua +++ b/lua/ht/plugins/ui/alpha-nvim.lua @@ -10,6 +10,8 @@ if Const.is_gui then dependencies[#dependencies + 1] = "TwIStOy/project.nvim" end +local after_lazy_vim_started = false + local M = { "goolord/alpha-nvim", cond = function() @@ -262,7 +264,16 @@ local function build_recent_files_section() { type = "group", val = function() - return { mru(1, vim.fn.getcwd(), 5) } + if after_lazy_vim_started then + return { mru(1, vim.fn.getcwd(), 5) } + else + return { + { + type = "text", + val = "Loading...", + }, + } + end end, opts = { shrink_margin = false }, }, @@ -424,6 +435,7 @@ M.config = function() -- code to run after plugin loaded pattern = "LazyVimStarted", once = true, callback = function() + after_lazy_vim_started = true require("alpha").redraw() end, })