Skip to content

Instantly share code, notes, and snippets.

@NigoroJr
Last active January 31, 2016 21:20
Show Gist options
  • Select an option

  • Save NigoroJr/d2dc0b3a8363e67ebfc0 to your computer and use it in GitHub Desktop.

Select an option

Save NigoroJr/d2dc0b3a8363e67ebfc0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# Depending on the version of zplug that you are currently using, this
# function symlinks the other zplug version to $ZPLUG_HOME.
#
# $ git clone https://github.com/b4b4r07/zplug ~/.zplug_v1
# $ git clone https://github.com/b4b4r07/zplug2 ~/.zplug_v2
# $ source ~/.zplug_v1/zplug
# $ source this_script
# # Use v2
# $ switch-zplug-versions
switch-zplug-versions() {
if ! type zplug >/dev/null; then
echo 'zplug not found' 1>&2
return 1
fi
local now use
now=$( zplug version | grep -o '\b[0-9.]\+\b' | cut -d'.' -f1 )
if (( now == 2 )); then
use=v1
else
use=v2
fi
ln -sfnv ~/.zplug_$use $ZPLUG_HOME
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment