Skip to content

Instantly share code, notes, and snippets.

@neoascetic
Last active February 6, 2025 10:39
Show Gist options
  • Save neoascetic/7b1ac2568f81fd3068cf79396847c0d2 to your computer and use it in GitHub Desktop.
Save neoascetic/7b1ac2568f81fd3068cf79396847c0d2 to your computer and use it in GitHub Desktop.
You don't need a zsh framework. You need just plug!
# usage: plug! some/repo[:branch] [file-to.load ...]
# example: plug! sindresorhus/pure:main async.zsh pure.zsh
# to update everything - simply remove ~/.plug directory
function plug!() {
local arg=("${(@s/:/)1}") && r=$arg[1] && b=${arg[2]:=master}
local dir="$HOME/.plug/$r"
[[ -d $dir ]] || git clone --depth=1 --branch=$b https://github.com/$r $dir
for f in "${@:2}"; do source "$dir/$f"; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment