2022-12-23 19:55:49 +00: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
2023-03-22 15:06:27 +00:00
M.dimmed_commits = { " build " , " ci " , " chore " , " doc " , " test " }
2023-03-02 13:25:50 +00:00
2022-12-23 19:55:49 +00:00
M.keys = {
hover = " K " ,
2022-12-24 10:27:29 +00:00
diff = " d " ,
2022-12-23 19:55:49 +00:00
close = " q " ,
details = " <cr> " ,
profile_sort = " <C-s> " ,
profile_filter = " <C-f> " ,
2022-12-31 09:38:03 +00:00
abort = " <C-c> " ,
2022-12-23 19:55:49 +00: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 08:08:21 +00: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-23 19:55:49 +00: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 06:11:50 +00: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-23 19:55:49 +00:00
id = 13 ,
p lugins = true ,
plugins_required = true ,
} ,
2022-12-30 10:29:17 +00:00
health = {
desc = " Run `:checkhealth lazy` " ,
id = 14 ,
} ,
2023-01-01 08:41:43 +00:00
build = {
desc = " Rebuild a plugin " ,
2023-05-27 14:19:50 +01:00
id = 15 ,
2023-01-01 08:41:43 +00:00
plugins = true ,
plugins_required = true ,
2023-01-09 19:21:31 +00:00
key_plugin = " gb " ,
2023-01-01 08:41:43 +00:00
} ,
2023-05-27 14:19:50 +01:00
reload = {
desc = " Reload a plugin (experimental!!) " ,
plugins = true ,
plugins_required = true ,
id = 16 ,
} ,
2022-12-23 19:55:49 +00:00
}
return M