mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix(mini.starter): just do do VimResized for simpler approach
This commit is contained in:
parent
e2abb1ea4f
commit
5da98c76d8
1 changed files with 5 additions and 12 deletions
|
|
@ -53,16 +53,7 @@ return {
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
pattern = "MiniStarterOpened",
|
pattern = "MiniStarterOpened",
|
||||||
callback = function()
|
callback = function()
|
||||||
-- INFO: schedule_wrap this because if you are missing a plugin
|
require("lazy").show()
|
||||||
-- and the Lazy UI opens to install the missing plugin the
|
|
||||||
-- notification `buf_id in refresh() is not an identifier of valid
|
|
||||||
-- Starter buffer` shows up again
|
|
||||||
-- `vim.schedule` also seems to work but prefered `vim.schedule_wrap`
|
|
||||||
-- because on my understanding it triggers even later than `vim.schedule`
|
|
||||||
-- just to be on the safe side
|
|
||||||
vim.schedule_wrap(function()
|
|
||||||
require("lazy").show()
|
|
||||||
end)
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
@ -71,13 +62,15 @@ return {
|
||||||
starter.setup(config)
|
starter.setup(config)
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
pattern = "MiniStarterOpened",
|
pattern = "LazyVimStarted",
|
||||||
callback = function()
|
callback = function()
|
||||||
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"
|
||||||
pcall(starter.refresh)
|
-- 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]])
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue