đ Link Bin
An annex exposes a binary program without modifying $PATH
â z-a-linkbin
and automatically creates a hard or soft link to the binary at $ZPFX/bin
exposing the program to the command line as if it were being placed in $PATH
.
The command can then be accessed normally â not only in the live Zsh session but also from any Zsh script. The ice-modifier lbin''
provided by the annex creates links
for binaries and scripts.
It creates the link
that calls the actual binary. The link is created always under the same, standard and single $PATH
entry: $ZPFX/bin
Soft linkâ
The optional preceding !
flag means creating a soft link instead of a hard link.
Example:
zi ice from'gh-r' as'program' \ lbin'!fzf'zi load junegunn/fzf
Check the output:
ls -l $ZPFX/bin/ | awk '{print $(NF-2),$(NF-1),$NF}'fzf --version
Hard linkâ
The ice-modifier can contain globs as it will expand these when searching for the binary.
Example:
zi ice from'gh-r' as'program' \ lbin'**fzf -> myfzf'zi load junegunn/fzf
Check the output:
ls -l $ZPFX/bin/ | awk '{print $(NF-2),$(NF-1),$NF}'
myfzf --version
Auto nickname linkâ
If ice-modifier id-as is empty, then will try to create the link with a nickname as follows:
- Trailing component of the
id-as
ice-modifier, e.g.:id-as'exts/git-my'
â it will check if a filegit-my
exists and if yes, create the linkgit-my
. - The plugin name, e.g.: for
paulirish/git-open
it'll check if a filegit-open
exists and if yes, create the linkgit-open
. - Trailing component of the snippet URL.
- For any alphabetically first executable file.
The above also applies if just !
were passed.
Install linkbinâ
- Default
Add the following snippet in the .zshrc
file:
zi light z-shell/z-a-linkbin
This will register the lbin'âĻ'
ice-modifier.