feat: lazy setup with either a plugins module, or a plugins spec

This commit is contained in:
Folke Lemaitre 2022-12-01 13:33:55 +01:00
parent f0894be69d
commit af8b8e128e
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
8 changed files with 54 additions and 53 deletions

View file

@ -1,7 +1,8 @@
local M = {}
---@param spec LazySpec Should be a module name to load, or a plugin spec
---@param opts? LazyConfig
function M.setup(opts)
function M.setup(spec, opts)
local module_start = vim.loop.hrtime()
require("lazy.core.module").setup()
local Util = require("lazy.core.util")
@ -14,23 +15,11 @@ function M.setup(opts)
Util.track("setup")
Util.track("config")
Config.setup(opts)
Config.setup(spec, opts)
Util.track()
Plugin.load()
if Config.options.install_missing then
Util.track("install")
for _, plugin in pairs(Config.plugins) do
if not plugin._.installed then
vim.cmd("do User LazyInstallPre")
require("lazy.manage").install({ wait = true })
break
end
end
Util.track()
end
Util.track("loader")
Loader.setup()
Util.track()