mirror of https://github.com/folke/lazy.nvim.git
feat: expose all commands on main lazy module
This commit is contained in:
parent
0b4a04de7d
commit
f25f942eb7
|
@ -1,3 +1,4 @@
|
||||||
|
---@type LazyCommands
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
---@param spec LazySpec Should be a module name to load, or a plugin spec
|
---@param spec LazySpec Should be a module name to load, or a plugin spec
|
||||||
|
@ -87,4 +88,10 @@ function M.plugins()
|
||||||
return vim.tbl_values(require("lazy.core.config").plugins)
|
return vim.tbl_values(require("lazy.core.config").plugins)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
setmetatable(M, {
|
||||||
|
__index = function(_, key)
|
||||||
|
return require("lazy.view.commands").commands[key]
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -16,6 +16,7 @@ function M.cmd(cmd, plugins)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@class LazyCommands
|
||||||
M.commands = {
|
M.commands = {
|
||||||
clean = function(plugins)
|
clean = function(plugins)
|
||||||
Manage.clean({ clear = true, mode = "clean", plugins = plugins })
|
Manage.clean({ clear = true, mode = "clean", plugins = plugins })
|
||||||
|
@ -33,6 +34,9 @@ M.commands = {
|
||||||
home = function()
|
home = function()
|
||||||
View.show("home")
|
View.show("home")
|
||||||
end,
|
end,
|
||||||
|
show = function()
|
||||||
|
View.show("home")
|
||||||
|
end,
|
||||||
help = function()
|
help = function()
|
||||||
View.show("help")
|
View.show("help")
|
||||||
end,
|
end,
|
||||||
|
@ -44,8 +48,8 @@ M.commands = {
|
||||||
end,
|
end,
|
||||||
sync = function()
|
sync = function()
|
||||||
Manage.clean({ clear = true, wait = true, mode = "sync" })
|
Manage.clean({ clear = true, wait = true, mode = "sync" })
|
||||||
Manage.update({ interactive = true })
|
Manage.update()
|
||||||
Manage.install({ interactive = true })
|
Manage.install()
|
||||||
end,
|
end,
|
||||||
update = function(plugins)
|
update = function(plugins)
|
||||||
Manage.update({ clear = true, mode = "update", plugins = plugins })
|
Manage.update({ clear = true, mode = "update", plugins = plugins })
|
||||||
|
|
Loading…
Reference in New Issue