refactor: minor cleanup

This commit is contained in:
Dinesh Salunke 2023-09-10 12:45:19 +05:30
parent 7ee7e93a47
commit 84d91336e5

View File

@ -156,13 +156,14 @@ return {
return dashboard return dashboard
end, end,
config = function(_, dashboard) config = function(_, dashboard)
local lazy = require("lazy")
-- close Lazy and re-open when the dashboard is ready -- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then if vim.o.filetype == "lazy" then
vim.cmd.close() vim.cmd.close()
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd("User", {
pattern = "AlphaReady", pattern = "AlphaReady",
callback = function() callback = function()
require("lazy").show() lazy.show()
end, end,
}) })
end end
@ -172,7 +173,7 @@ return {
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted", pattern = "LazyVimStarted",
callback = function() callback = function()
local stats = require("lazy").stats() local stats = lazy.stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
pcall(vim.cmd.AlphaRedraw) pcall(vim.cmd.AlphaRedraw)