zap-zsh / zap

:zap: Zap is a minimal zsh plugin manager
https://www.zapzsh.com/
GNU General Public License v3.0
944 stars 34 forks source link

Feature Request: Allow multiple plugins from one repository #86

Open nineboxes opened 1 year ago

nineboxes commented 1 year ago

Hi there!

Currently zap tends you to create repository for each plugin you need. It's OK for some kind of public plugins but when you develop your own config usually you want to put all plugins in one place. In this case it would be nice to have a command that allows to "bundle" all plugins from the repository. For example, I have a repo with files:

├ my-exa.plugin.zsh
├ my-vim.plugin.zsh
├ my-work-prompt.plugin.zsh
└ my-home-prompt.plugin.zsh

And somewhere in the .zshrc I just simply write:

…
bundle "username/zap-config"
…

And all these plugins should be sourced.


Also (I'm not sure if we can do it in bash) additionally it would be nice to have an option that can skip one or more plugins from the repo. For example, in my current repo I have two plugins for prompt and for my home machine I want to use only my-home-prompt.plugin.zsh by excluding my-work-prompt.plugin.zsh like this:

# my home bash config
…
bundle "username/zap-config" -e my-work-prompt my-vim # also exclude my-vim
…

The reason because we should add "exclude" instead of some kind of white/black lists is that "Zap is a minimal zsh plugin manager" and we should expect the default behavior as it is without any complex side effects.

mamaraddio commented 1 year ago

Technically me, Chris , or any other zap cantributor, could work on this feature but I think this leads to a "side effect": this addition will grow the codebase making the concept of zap "less minimal". Could also be an idea to create two different branches like "minimal" (that will be the default branch) and "extended" (that will contains all these, and/or future, new features) and the users will chose which branch to checkout when installing zap.

For now a workaround could be to clone your repo somewhere and then put the following lines in you ". zshrc"

for plugin in path_to_repo/*; do
    plug "path_to_repo/$plugin"
done

In these way zap should source all the plugins in that directory but you'll need to manually clone it on your system and if you want to exclude a plugin you have to remove/move that plugin, and maybe you'll need to delete all "non plugin" files/folders to avoid unexpected behaviours

@ChristianChiarulli what do you think about it?

ChristianChiarulli commented 1 year ago

Is this a common convention implemented by other plugin managers and often implemented for plugins?

wintermi commented 1 year ago

Not sure that it is a common convention but there are other plugin managers such as 'zplug' which have tags that could cater for this scenario.