Nickname a plugin or snippet#

Zplugin supports loading a plugin or snippet with a nickname. Set the nickname through the id-as ice-mod. For example, one could try to load docker/compose from GitHub binary releases:

zplugin ice as"program" from"gh-r" mv"docker-c* -> docker-compose"
zplugin light "docker/compose"

This registers plugin under the ID docker/compose. Now suppose the user would want to also load a completion from the project's GitHub repository (not the binary release catalog) which is also available under the GitHub url-path …/docker/compose. The two IDs, both being "docker/compose", will collide.

The solution to this problem – the id-as (to be read as: identify-as) ice to which this document is devoted: by using the id-as ice the user can resolve the conflict by loading the completion under a kind of a nickname, for example under "dc-complete", by issuing the following commands:

zplugin ice as"completion" id-as"dc-complete"
zplugin load docker/compose

The plugin (of the type completion) is now seen under ID dc-complete:

~ zplugin list | grep -i dc-complete
dc-complete

Issuing zplugin report dc-complete also works, so as other Zplugin commands:

~ zplugin report dc-complete
Plugin report for dc-complete
-------------------------------

Completions:
_docker-compose [enabled]

This can be also used to nickname snippets. For example, you can use this to create handy IDs in place of long urls:

zplugin ice as"program" id-as"git-unique"
zplugin snippet https://github.com/Osse/git-scripts/blob/master/git-unique

The commands zplugin update git-unique, zplugin delete git-unique and other will work normally and e.g. zplugin times will show the nickname-ID git-unique instead of the long URL.