feat(pack): rebuild plugins on :PluginUpdate
This commit is contained in:
+34
-5
@@ -17,14 +17,43 @@ vim.api.nvim_create_user_command("PluginUnwatch", function()
|
||||
require("pack").unwatch()
|
||||
end, { desc = "Stop watching plugin configs" })
|
||||
|
||||
local function complete_plugin_names(lead)
|
||||
return vim.tbl_filter(function(name)
|
||||
return name:find(lead, 1, true) == 1
|
||||
end, require("pack").get_names())
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("PluginReload", function(opts)
|
||||
require("pack").reload_plugin(opts.args)
|
||||
end, {
|
||||
nargs = 1,
|
||||
complete = function(lead)
|
||||
return vim.tbl_filter(function(name)
|
||||
return name:find(lead, 1, true) == 1
|
||||
end, require("pack").get_names())
|
||||
end,
|
||||
complete = complete_plugin_names,
|
||||
desc = "Reload a plugin config by name",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("PluginUpdate", function(opts)
|
||||
local names = #opts.fargs > 0 and opts.fargs or nil
|
||||
require("pack").update(names)
|
||||
end, {
|
||||
nargs = "*",
|
||||
complete = complete_plugin_names,
|
||||
desc = "Update plugins (fetch from remote)",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("PluginUpdateOffline", function(opts)
|
||||
local names = #opts.fargs > 0 and opts.fargs or nil
|
||||
require("pack").update(names, { offline = true })
|
||||
end, {
|
||||
nargs = "*",
|
||||
complete = complete_plugin_names,
|
||||
desc = "Show pending plugin updates without fetching from remote",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("PluginRestore", function(opts)
|
||||
local names = #opts.fargs > 0 and opts.fargs or nil
|
||||
require("pack").update(names, { target = "lockfile" })
|
||||
end, {
|
||||
nargs = "*",
|
||||
complete = complete_plugin_names,
|
||||
desc = "Restore plugins to revisions in the lockfile",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user