2022-12-24 03:55:49 +08:00
local M = { }
---@class LazyViewCommand
---@field id number
---@field plugins? boolean
---@field plugins_required? boolean
---@field button? boolean
---@field desc? string
---@field desc_plugin? string
---@field key? string
---@field key_plugin? string
---@field toggle? boolean
function M . get_commands ( )
---@type (LazyViewCommand|{name:string})[]
local ret = { }
for k , v in pairs ( M.commands ) do
v.name = k
ret [ # ret + 1 ] = v
end
table.sort ( ret , function ( a , b )
return a.id < b.id
end )
return ret
end
2024-03-22 16:18:36 +08:00
M.dimmed_commits = { " bot " , " build " , " ci " , " chore " , " doc " , " style " , " test " }
2023-03-02 21:25:50 +08:00
2022-12-24 03:55:49 +08:00
M.keys = {
hover = " K " ,
2022-12-24 18:27:29 +08:00
diff = " d " ,
2022-12-24 03:55:49 +08:00
close = " q " ,
details = " <cr> " ,
profile_sort = " <C-s> " ,
profile_filter = " <C-f> " ,
2022-12-31 17:38:03 +08:00
abort = " <C-c> " ,
2024-06-29 20:22:53 +08:00
next = " ]] " ,
prev = " [[ " ,
2022-12-24 03:55:49 +08:00
}
---@type table<string,LazyViewCommand>
M.commands = {
home = {
button = true ,
desc = " Go back to plugin list " ,
id = 1 ,
key = " H " ,
} ,
install = {
button = true ,
desc = " Install missing plugins " ,
desc_plugin = " Install a plugin " ,
id = 2 ,
key = " I " ,
key_plugin = " i " ,
plugins = true ,
} ,
update = {
button = true ,
desc = " Update plugins. This will also update the lockfile " ,
desc_plugin = " Update a plugin. This will also update the lockfile " ,
id = 3 ,
key = " U " ,
key_plugin = " u " ,
plugins = true ,
} ,
sync = {
button = true ,
desc = " Run install, clean and update " ,
desc_plugin = " Run install, clean and update " ,
id = 4 ,
key = " S " ,
plugins = true ,
} ,
clean = {
button = true ,
desc = " Clean plugins that are no longer needed " ,
desc_plugin = " Delete a plugin. WARNING: this will delete the plugin even if it should be installed! " ,
id = 5 ,
key = " X " ,
key_plugin = " x " ,
plugins = true ,
} ,
check = {
button = true ,
desc = " Check for updates and show the log (git fetch) " ,
desc_plugin = " Check for updates and show the log (git fetch) " ,
id = 6 ,
key = " C " ,
key_plugin = " c " ,
plugins = true ,
} ,
log = {
button = true ,
desc = " Show recent updates " ,
desc_plugin = " Show recent updates " ,
id = 7 ,
key = " L " ,
key_plugin = " gl " ,
plugins = true ,
} ,
restore = {
button = true ,
2022-12-30 16:08:21 +08:00
desc = " Updates all plugins to the state in the lockfile. For a single plugin: restore it to the state in the lockfile or to a given commit under the cursor " ,
desc_plugin = " Restore a plugin to the state in the lockfile or to a given commit under the cursor " ,
2022-12-24 03:55:49 +08:00
id = 8 ,
key = " R " ,
key_plugin = " r " ,
plugins = true ,
} ,
profile = {
button = true ,
desc = " Show detailed profiling " ,
id = 9 ,
key = " P " ,
toggle = true ,
} ,
debug = {
button = true ,
desc = " Show debug information " ,
id = 10 ,
key = " D " ,
toggle = true ,
} ,
help = {
button = true ,
desc = " Toggle this help page " ,
id = 11 ,
key = " ? " ,
toggle = true ,
} ,
clear = {
desc = " Clear finished tasks " ,
id = 12 ,
} ,
load = {
2023-01-06 14:11:50 +08:00
desc = " Load a plugin that has not been loaded yet. Similar to `:packadd`. Like `:Lazy load foo.nvim`. Use `:Lazy! load` to skip `cond` checks. " ,
2022-12-24 03:55:49 +08:00
id = 13 ,
plugins = true ,
plugins_required = true ,
} ,
2022-12-30 18:29:17 +08:00
health = {
desc = " Run `:checkhealth lazy` " ,
id = 14 ,
} ,
2023-01-01 16:41:43 +08:00
build = {
desc = " Rebuild a plugin " ,
2023-05-27 21:19:50 +08:00
id = 15 ,
2023-01-01 16:41:43 +08:00
plugins = true ,
plugins_required = true ,
2023-01-10 03:21:31 +08:00
key_plugin = " gb " ,
2023-01-01 16:41:43 +08:00
} ,
2023-05-27 21:19:50 +08:00
reload = {
desc = " Reload a plugin (experimental!!) " ,
plugins = true ,
plugins_required = true ,
id = 16 ,
} ,
2022-12-24 03:55:49 +08:00
}
return M