style: added more comments to init

This commit is contained in:
Folke Lemaitre 2022-12-01 16:37:50 +01:00
parent ac9e5401dc
commit e22e8e4506
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 15 additions and 9 deletions

View File

@ -28,6 +28,7 @@ function M.setup()
end
function M.init_plugins()
Util.track("loader")
Util.track({ start = "init" })
for _, plugin in pairs(Config.plugins) do
if plugin.init then
@ -40,6 +41,7 @@ function M.init_plugins()
end
end
Util.track()
Util.track()
end
---@class Loader

View File

@ -4,35 +4,39 @@ local M = {}
---@param opts? LazyConfig
function M.setup(spec, opts)
local start = vim.loop.hrtime()
-- load module cache before anything else
require("lazy.core.module").setup()
local Util = require("lazy.core.util")
local Config = require("lazy.core.config")
local Loader = require("lazy.core.loader")
local Plugin = require("lazy.core.plugin")
Util.track({ plugin = "lazy.nvim" })
Util.track({ plugin = "lazy.nvim" }) -- setup start
Util.track("module", vim.loop.hrtime() - start)
-- load config
Util.track("config")
Config.setup(spec, opts)
Util.track()
-- load the plugins
Plugin.load()
Util.track("loader")
-- setup loader and handlers
Loader.setup()
Util.track()
-- correct time delta and loaded
local delta = vim.loop.hrtime() - start
Util.track().time = delta -- end setup
Loader.init_plugins()
if Config.plugins["lazy.nvim"] then
Config.plugins["lazy.nvim"]._.loaded = { time = delta, source = "init.lua" }
end
-- load plugins with lazy=false or Plugin.init
Loader.init_plugins()
-- all done!
vim.cmd("do User LazyDone")
end
@ -48,7 +52,7 @@ function M.stats()
end
function M.bootstrap()
local lazypath = vim.fn.stdpath("data") .. "/site/pack/lazy/start/lazy.nvim"
local lazypath = vim.fn.stdpath("data") .. "/site/pack/lazy/opt/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",