Hi, it is currently possible to enforce sequencing by using the after key. However, I think this is not very practical as it creates tight coupling between plugins and may prevent plugins to load if something in the after list is not present.
Oftentimes, a plugin may be able to run without a given other plugin. If the other plugin is found, it may perform extra config settings. For example, imagine in your config function you want to check if the user has telescope enabled, and if so, use that, otherwise some default. If telescope exists, then we want sequencing, but if not, then we don't care.
So I propose a priority key in the options. By default, it would be 0 for everything, meaning they can be installed in parallel. This would allow a plugin to increase its priority, ensuring it will be installed before any other plugin. It would also remove the explicit coupling.
require("packer").startup(function(use)
use({ "wbthomason/packer.nvim", opt = true })
-- use the priority key to ensure telescope is installed before
-- any other plugin with default prio 0
use({"nvim-telescope/telescope.nvim", priority = -1 })
use({
"myplug",
config = function()
-- setup some plugin
local p = require("myplug")
p.setup()
-- register the plugin with telescope, if its there
local ok, ts = pcall(require("telescope"))
if ok then ts.load_extension(p.as_telescope_extension()) end
end,
})
end)
can't the order of the use call be used instead of the priority value? No idea how packer implements compilation and how it invalidates the compiled code, so not sure how to implement this.
Describe the feature
Hi, it is currently possible to enforce sequencing by using the after key. However, I think this is not very practical as it creates tight coupling between plugins and may prevent plugins to load if something in the after list is not present.
Oftentimes, a plugin may be able to run without a given other plugin. If the other plugin is found, it may perform extra config settings. For example, imagine in your config function you want to check if the user has telescope enabled, and if so, use that, otherwise some default. If telescope exists, then we want sequencing, but if not, then we don't care.
So I propose a priority key in the options. By default, it would be 0 for everything, meaning they can be installed in parallel. This would allow a plugin to increase its priority, ensuring it will be installed before any other plugin. It would also remove the explicit coupling.