savq / paq-nvim

🌚 Neovim package manager
MIT License
649 stars 39 forks source link

feat: adding query method to paq #165

Closed saccarosium closed 7 months ago

saccarosium commented 7 months ago

Related to: #164

This little new method let's query paq's registry of packages to let the user have custom functionality like notify if the are packages to install at startup.

Example

Notify user when there are new packages to install.

vim.api.nvim_create_autocmd("VimEnter", {
    once = true,
    callback = function() 
            local pkgs_count = #require("paq").query("to_install")
            if pkgs_count < 1 then return end
        print(string.format("There are %d to install", pkgs_count))
    end
})

You can even setup automatic packages installation at startup.

vim.api.nvim_create_autocmd("VimEnter", {
    once = true,
    callback = function() 
            local pkgs_count = #require("paq").query("to_install")
            if pkgs_count < 1 then return end
            require("paq").install()
    end
})
saccarosium commented 7 months ago

I've made the changes.

I think we might also revamp the docs to provide a cookbook with some o the ways you could use paq to achieve some of the behaviors that other package managers has. But in another commit.

savq commented 7 months ago

I think we might also revamp the docs to provide a cookbook with some o the ways you could use paq to achieve some of the behaviors that other package managers has. But in another commit.

Yeah, there's a little bit of that in the misc section of the docs. We can add more info there.

There's never too much documentation 🤓