feat(keys): include custom keys in help menu (#1105)

This commit is contained in:
Maria José Solano 2023-10-11 22:18:53 -07:00 committed by GitHub
parent 906ff8e569
commit 43c284a578
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 47 deletions

View file

@ -121,9 +121,10 @@ function M.create()
end
end)
for key, handler in pairs(Config.options.ui.custom_keys) do
if handler then
self:on_key(key, function()
for lhs, rhs in pairs(Config.options.ui.custom_keys) do
if rhs then
local handler = type(rhs) == "table" and rhs[1] or rhs
self:on_key(lhs, function()
local plugin = self.render:get_plugin()
if plugin then
handler(plugin)

View file

@ -209,6 +209,14 @@ function M:help()
self:append(" " .. (mode.desc_plugin or mode.desc)):nl()
end
end
for lhs, rhs in pairs(Config.options.ui.custom_keys) do
if type(rhs) == "table" and rhs.desc then
self:append("- ", "LazySpecial", { indent = 2 })
self:append("Custom key ", "Title")
self:append(lhs, "LazyProp")
self:append(" " .. rhs.desc):nl()
end
end
end
function M:progressbar()