跳到主要内容

🌀 Unscope

z-shell/z-a-unscope

An aannex allows to install plugins without specifying the GitHub user name.

It works as follows:

  1. On the installation of a plugin without any slashes (/) in its name the annex will query the GitHub API searching for */{the-name}, sorting on stars.

  2. It first requires at least 10 forks on the candidates, then 2, then 0.

  3. After finding the best result it sets it as the full remote-id of the plugin, storing the ID on disk for later automatic use.

  4. For security, for such GH-API request to be made a newly added (by this annex) ice: ghapi is required to be given.

  5. Otherwise only the static database of mappings of short-plugin nicknames to the full scoped IDs will be searched. It contains many mappings, like, e.g.: vi-regzsh-vi-more/evil-registers, and also the usual basic unscopings of some of the popular plugins out there, like, e.g.: zsh-syntax-highlightingzsh-users/zsh-syntax-highlighting and more.

Static mappings

Besides the GitHub-API querying, there's also a fixed, curated list of mappings of short names to the full GitHub IDs. The list currently consists of:

Short (Nick-) NameGitHub ID / scoped ID
nullz-shell/null
z-a-readurlz-shell/z-a-readurl
readurlz-shell/z-a-readurl
rdurlz-shell/z-a-readurl
z-a-patch-dlz-shell/z-a-patch-dl
patch-dlz-shell/z-a-patch-dl
z-a-submodsz-shell/z-a-submods
submodsz-shell/z-a-submods
z-a-rustz-shell/z-a-rust
rustz-shell/z-a-rust
z-a-bin-gem-nodez-shell/z-a-bin-gem-node
bin-gem-nodez-shell/z-a-bin-gem-node
bgnz-shell/z-a-bin-gem-node
metaz-shell/z-a-meta-plugins
metaplgz-shell/z-a-meta-plugins
meta-pluginsz-shell/z-a-meta-plugins
archivePZTM::archive
archPZTM::archive
directoryPZTM::directory
dirPZTM::directory
environmentPZTM::environment
envPZTM::environment
utilityPZTM::utility
utilPZTM::utility
fast-syntax-highlightingz-shell/fast-syntax-highlighting
f-sy-hz-shell/fast-syntax-highlighting
fshz-shell/fast-syntax-highlighting
history-search-multi-wordz-shell/history-search-multi-word
hsmwz-shell/history-search-multi-word
zuiz-shell/zui
ZUIz-shell/zui
zconveyz-shell/zconvey
zconvz-shell/zzconvey
zbrowsez-shell/zbrowse
zzcompletez-shell/zzcomplete
zzcompz-shell/zzcomplete
zzcomz-shell/zzcomplete
zsh-autosuggestionszsh-users/zsh-autosuggestions
autosuggestionszsh-users/zsh-autosuggestions
autosugzsh-users/zsh-autosuggestions
asugzsh-users/zsh-autosuggestions
z-asugzsh-users/zsh-autosuggestions
zsh-syntax-highlightingzsh-users/zsh-syntax-highlighting
z-sy-hzsh-users/zsh-syntax-highlighting
zsh-autocompletemarlonrichert/zsh-autocomplete
autocompletemarlonrichert/zsh-autocomplete
autocompmarlonrichert/zsh-autocomplete
aucommarlonrichert/zsh-autocomplete
acommarlonrichert/zsh-autocomplete
z-aucommarlonrichert/zsh-autocomplete
z-acommarlonrichert/zsh-autocomplete
zsh-autopairhlissner/zsh-autopair
autopairhlissner/zsh-autopair
aupairhlissner/zsh-autopair
aupahlissner/zsh-autopair
z-aupahlissner/zsh-autopair
evil-registerszsh-vi-more/evil-registers
evil-regzsh-vi-more/evil-registers
vi-regzsh-vi-more/evil-registers
viregzsh-vi-more/evil-registers
vi-motionszsh-vi-more/vi-motions
evil-motzsh-vi-more/vi-motions
vi-motzsh-vi-more/vi-motions
vimotzsh-vi-more/vi-motions
vi-incrementzsh-vi-more/vi-increment
evil-inczsh-vi-more/vi-increment
vi-inczsh-vi-more/vi-increment
viinczsh-vi-more/vi-increment
vi-quotezsh-vi-more/vi-quote
evil-qtezsh-vi-more/vi-quote
vi-qtezsh-vi-more/vi-quote
viqtezsh-vi-more/vi-quote
directory-markszsh-vi-more/directory-marks
evil-dir-markszsh-vi-more/directory-marks
vi-dir-markszsh-vi-more/directory-marks
vi-dirmazsh-vi-more/directory-marks
vidirmazsh-vi-more/directory-marks
fdsharkdp/fd
shark-fdsharkdp/fd
batsharkdp/bat
shark-batsharkdp/bat
exaogham/exa
zsh-completionszsh-users/zsh-completions
completionszsh-users/zsh-completions
compszsh-users/zsh-completions

You can let me know if you would like a name to be added to the list.

Usage examples

  • An example installation via 2 nicknames (env and vi-reg) and by one unscoped (i.e.: not using any GitHub username) ID that's being dynamically resolved by a request to GitHub API:

zi-for-command

  • An example call to the zi scope … subcommand that is added by this annex. It allows to translate the unscoped IDs and the short-static nicknames into the full username/repository plugin ID.

scope-subcommand

Install unscope

Simply load as a regular plugin, i.e.:

zi light-mode for z-shell/z-a-unscope

It should be done possibly early in the zshrc, as otherwise the preceding zi calls will not have the unscoped IDs resolved.