zr 1.0.0

quick, simple zsh package manager
zr-1.0.0 is not a library.
Visit the last successful build: zr-0.6.4

z :rat:

License: MPL 2.0 Build Status

Quick, simple zsh plugin manager

zr 0.9.0
by Jonathan Dahan <github@jonathan.is>

zr --update                                                    updates loaded files listened in _ZR environment variable
zr [[http://example.com]plugin/name[.git/path/to/file.zsh]]    fetch or update plugins and output sourceable zsh
zr help                                                        show help

install

You can use crates.io and cargo to just cargo install zr

usage

Add this to your ~/.zshrc:

# Generate new ~/.zr/init.zsh if it does not exist or ~/.zshrc is newer
if [[ ! -f ~/.config/zr.zsh ]] || [[ ~/.zshrc -nt ~/.config/zr.zsh ]]; then
  zr \
    frmendes/geometry \
    jedahan/geometry-hydrate \
    junegunn/fzf.git/shell/key-bindings.zsh \
    > ~/.config/zr.zsh
fi

source ~/.config/zr.zsh

identifiers

zr supports four identifier formats, note that the last format requires .git as a delimeter.

format resolves to
author/name *.zsh from https://github.com/author/name
author/name/file.zsh file.zsh from https://github.com/author/name
https://gitlab.com/a/plugin *.zsh from https://gitlab.com/a/plugin
https://gitlab.com/a/plugin.git/file.zsh file.zsh from https://gitlab.com/a/plugin.git. The .git is used as a delimeter, and is required.

speed

The following benchmark.zsh takes 8ms to generate the file.

# install hyperfine for benchmarking
cargo install hyperfine

hyperfine --warmup 3 'zsh -d -f -l -c "source benchmark.zsh && zrinit && exit"' 'zsh -d -f -l -c "source benchmark.zsh && . <(zrinit) && exit"'
# zr generation time
Benchmark #1: zsh -d -f -l -c "source benchmark.zsh && zrinit && exit"
  Time (mean ± σ):       8.6 ms ±   1.6 ms    [User: 4.4 ms, System: 4.3 ms]
  Range (min … max):     6.1 ms …  12.8 ms    234 runs

# zr generation + zsh load time
Benchmark #2: zsh -d -f -l -c "source benchmark.zsh && . <(zrinit) && exit"
  Time (mean ± σ):      36.8 ms ±   2.7 ms    [User: 28.8 ms, System: 9.3 ms]
  Range (min … max):    33.4 ms …  48.2 ms    69 runs

# benchmark.zsh
function zrinit {
  XDG_CACHE_HOME=/tmp/zrbenchmark zr sorin-ionescu/prezto.git/modules/git/alias.zsh \
    sorin-ionescu/prezto.git/modules/history/init.zsh \
    junegunn/fzf.git/shell/key-bindings.zsh \
    zsh-users/zsh-autosuggestions \
    zdharma/fast-syntax-highlighting \
    molovo/tipz \
    geometry-zsh/geometry \
    jedahan/geometry-hydrate \
    jedahan/geometry-todo \
    geometry-zsh/geometry \
    ael-code/zsh-colored-man-pages \
    momo-lab/zsh-abbrev-alias \
    jedahan/alacritty-completions \
    zpm-zsh/ssh
}

thanks