fix(mini.starter): changes based on echasnovski's recommendation (#3223)

This commit is contained in:
Iordanis Petkakis
2024-05-18 19:14:35 +03:00
committed by GitHub
parent a4d83524a7
commit eb6c9fb578

View File

@ -63,14 +63,15 @@ return {
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
callback = function(ev)
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
local pad_footer = string.rep(" ", 8)
starter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
-- INFO: Use `VimResized` to avoid the `buf_id in refresh() is not an identifier of valid Starter buffer`,
-- since `starter.refresh` executes on every `VimResized` see https://github.com/echasnovski/mini.starter/blob/f0c491032dcda485ee740716217cd4d5c25b6014/lua/mini/starter.lua#L352-L353
vim.cmd([[do VimResized]])
-- INFO: based on @echasnovski's recommendation (thanks a lot!!!)
if vim.bo[ev.buf].filetype == "starter" then
pcall(starter.refresh)
end
end,
})
end,