mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 12:56:46 +00:00
refactor(commands): move ui/commands config to separate file
This commit is contained in:
parent
c1f39f997d
commit
83270cc5e5
6 changed files with 195 additions and 86 deletions
|
@ -75,15 +75,7 @@ end
|
|||
|
||||
function M.commands()
|
||||
local commands = require("lazy.view.commands").commands
|
||||
---@type table<string,{desc:string, plugin:boolean, opts:boolean}>
|
||||
local modes = {}
|
||||
for _, mode in ipairs(require("lazy.view").modes) do
|
||||
modes[mode.name] = modes[mode.name] or {}
|
||||
modes[mode.name].plugin = modes[mode.name].plugin or mode.plugin
|
||||
if not modes[mode.name].desc or not mode.plugin then
|
||||
modes[mode.name].desc = mode.desc
|
||||
end
|
||||
end
|
||||
local modes = require("lazy.view.config").commands
|
||||
modes.load.opts = true
|
||||
local lines = {
|
||||
{ "Command", "Lua", "Description" },
|
||||
|
@ -91,13 +83,13 @@ function M.commands()
|
|||
}
|
||||
Util.foreach(modes, function(name, mode)
|
||||
if commands[name] then
|
||||
if mode.opts then
|
||||
if mode.plugins_required then
|
||||
lines[#lines + 1] = {
|
||||
("`:Lazy %s {plugins}`"):format(name),
|
||||
([[`require("lazy").%s(opts)`]]):format(name),
|
||||
mode.desc,
|
||||
}
|
||||
elseif mode.plugin then
|
||||
elseif mode.plugins then
|
||||
lines[#lines + 1] = {
|
||||
("`:Lazy %s [plugins]`"):format(name),
|
||||
([[`require("lazy").%s(opts?)`]]):format(name),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue