packer.nvim icon indicating copy to clipboard operation
packer.nvim copied to clipboard

Lazy-loading dependencies, too

Open subsetpark opened this issue 3 years ago • 3 comments

Describe the feature

I have an entry for Octo, which has a few dependencies:

    use {
        'pwntester/octo.nvim',
        requires = {
            'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim',
            'kyazdani42/nvim-web-devicons'
        },
        cmd = {'Octo'},
        config = function() require"octo".setup() end,
    }

because cmd is specified, Octo is not loaded at startup. However, its three dependencies, which are not used themselves, are.

...
 • nvim-treesitter
 • nvim-web-devicons
 • octo.nvim (not loaded)
 • packer.nvim
 • plenary.nvim
...

It would be nice if Packer could tell which dependencies are not required by any other package, and load them at the same time it lazy loads the package that requires them.

subsetpark avatar Jan 07 '22 16:01 subsetpark

    use {
        'pwntester/octo.nvim',
        wants = {
            'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim',
            'kyazdani42/nvim-web-devicons'
        },
        cmd = {'Octo'},
        config = function() require"octo".setup() end,
    }

Does it work if you replace require with wants?

kuator avatar Jan 25 '22 15:01 kuator

I think this is the same issue as mentioned in #803

xulongwu4 avatar Feb 06 '22 15:02 xulongwu4

Anyone found a solution to this?

weilbith avatar Mar 08 '23 16:03 weilbith