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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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