feat(cmd): added `Lazy load all` to load all plugins

This commit is contained in:
Folke Lemaitre 2023-05-18 19:51:14 +02:00
parent 53e1c49bae
commit 11131eafa1
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,9 @@ function M.complete(cmd, prefix)
end end
---@type string[] ---@type string[]
local plugins = {} local plugins = {}
if cmd == "load" then
plugins[#plugins + 1] = "all"
end
for name, plugin in pairs(Config.plugins) do for name, plugin in pairs(Config.plugins) do
if cmd ~= "load" or not plugin._.loaded then if cmd ~= "load" or not plugin._.loaded then
plugins[#plugins + 1] = name plugins[#plugins + 1] = name
@ -86,6 +89,9 @@ function M.setup()
---@type ManagerOpts ---@type ManagerOpts
local opts = { wait = cmd.bang == true } local opts = { wait = cmd.bang == true }
local prefix, args = M.parse(cmd.args) local prefix, args = M.parse(cmd.args)
if #args == 1 and args[1] == "all" then
args = vim.tbl_keys(Config.plugins)
end
if #args > 0 then if #args > 0 then
---@param plugin string ---@param plugin string
opts.plugins = vim.tbl_map(function(plugin) opts.plugins = vim.tbl_map(function(plugin)