mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-18 20:36:45 +00:00
docs: generate docs for commands
This commit is contained in:
parent
f25f942eb7
commit
1730661ec2
4 changed files with 72 additions and 17 deletions
|
@ -16,6 +16,7 @@ M.modes = {
|
|||
{ name = "profile", key = "P", desc = "Show detailed profiling", toggle = true },
|
||||
{ name = "debug", key = "D", desc = "Show debug information", toggle = true },
|
||||
{ name = "help", key = "?", desc = "Toggle this help page", toggle = true },
|
||||
{ name = "clear", desc = "Clear finished tasks", hide = true },
|
||||
|
||||
{ plugin = true, name = "update", key = "u", desc = "Update this plugin. This will also update the lockfile" },
|
||||
{
|
||||
|
@ -163,21 +164,23 @@ function M.show(mode)
|
|||
})
|
||||
|
||||
for _, m in ipairs(M.modes) do
|
||||
vim.keymap.set("n", m.key, function()
|
||||
local Commands = require("lazy.view.commands")
|
||||
if m.plugin then
|
||||
local plugin = get_plugin()
|
||||
if plugin then
|
||||
Commands.cmd(m.name, { plugin })
|
||||
if m.key then
|
||||
vim.keymap.set("n", m.key, function()
|
||||
local Commands = require("lazy.view.commands")
|
||||
if m.plugin then
|
||||
local plugin = get_plugin()
|
||||
if plugin then
|
||||
Commands.cmd(m.name, { plugin })
|
||||
end
|
||||
else
|
||||
if M.mode == m.name and m.toggle then
|
||||
M.mode = nil
|
||||
return update()
|
||||
end
|
||||
Commands.cmd(m.name)
|
||||
end
|
||||
else
|
||||
if M.mode == m.name and m.toggle then
|
||||
M.mode = nil
|
||||
return update()
|
||||
end
|
||||
Commands.cmd(m.name)
|
||||
end
|
||||
end, { buffer = buf })
|
||||
end, { buffer = buf })
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
|
|
|
@ -150,8 +150,11 @@ function M:help()
|
|||
for _, mode in ipairs(View.modes) do
|
||||
local title = mode.name:sub(1, 1):upper() .. mode.name:sub(2)
|
||||
self:append("- ", "LazySpecial", { indent = 2 })
|
||||
self:append(title, "Title"):append(" <" .. mode.key .. "> ", "LazyKey")
|
||||
self:append(mode.desc or ""):nl()
|
||||
self:append(title, "Title")
|
||||
if mode.key then
|
||||
self:append(" <" .. mode.key .. ">", "LazyKey")
|
||||
end
|
||||
self:append(" " .. (mode.desc or "")):nl()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue