Crates.io | zr |
lib.rs | zr |
version | 1.1.0 |
source | src |
created_at | 2017-10-02 16:20:06.44021 |
updated_at | 2023-02-25 18:47:29.38021 |
description | quick, simple zsh package manager |
homepage | |
repository | https://github.com/jedahan/zr.git |
max_upload_size | |
id | 34186 |
size | 191,010 |
Quick, simple zsh plugin manager
zr 1.1.0
by Jonathan Dahan <hi@jonathan.is>
zr [[http://example.com]plugin/name[.git/a/file.zsh]] fetch plugins and output sourceable zsh
zr --update updates plugins from already sourced zsh
zr help show help
Examples
zr author/name *.zsh from github.com/author/name
zr author/name/file.zsh file.zsh from github.com/author/name
zr https://gitlab.com/a/plugin *.zsh from gitlab.com/a/plugin
zr https://gitlab.com/a/plugin.git/file.zsh file.zsh from gitlab.com/a/plugin
zr
is published to crates.io, and can be installed with cargo install zr
Add this to your ~/.zshrc:
# simplest usage
. <(zr frmendes/geometry junegunn/fzf.git/shell/key-bindings.zsh)
A bit more complex example, that only generates when .zshrc has been updated:
# Generate new ~/.config/zr.zsh if it does not exist or if ~/.zshrc has been changed
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
zr
supports four identifier formats. 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.
The following two benchmarks show on my dell xps13 9380
# install hyperfine for benchmarking
$ which hyperfine || cargo install hyperfine
# run
$ hyperfine --warmup 3 'zsh -d -f -l -c "source benchmark.zsh && zrinit && exit"' 'zsh -d -f -l -c "source benchmark.zsh && . <(zrinit) && exit"'
Benchmark #1: zsh -d -f -l -c "source benchmark.zsh && zrinit && exit"
Time (mean ± σ): 5.3 ms ± 2.3 ms [User: 2.8 ms, System: 2.4 ms]
Range (min … max): 2.9 ms … 9.9 ms 285 runs
Benchmark #2: zsh -d -f -l -c "source benchmark.zsh && . <(zrinit) && exit"
Time (mean ± σ): 21.8 ms ± 1.0 ms [User: 17.5 ms, System: 5.1 ms]
Range (min … max): 19.7 ms … 26.4 ms 127 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
}