45 lines
963 B
Bash
45 lines
963 B
Bash
#
|
|
# zplug plugin manager
|
|
#
|
|
ZSPR_ZPLUG_HOME="${ZSHUPER_DIR}/zplug"
|
|
|
|
function __zspr_zplug_init {
|
|
if [ ! -d "${ZSPR_ZPLUG_HOME}" ]; then
|
|
git clone --depth=1 https://github.com/zplug/zplug "${ZSPR_ZPLUG_HOME}"
|
|
fi
|
|
|
|
source "${ZSPR_ZPLUG_HOME}/init.zsh"
|
|
zplug "zplug/zplug"
|
|
}
|
|
|
|
function __zspr_zplug_load_plugins {
|
|
for plugin in ${ZSHUPER_PLUGINS}; do
|
|
__zspr_zplug_install_plugin "${plugin}"
|
|
done
|
|
|
|
if ! zplug check; then
|
|
zplug install
|
|
fi
|
|
zplug load
|
|
}
|
|
|
|
function __zspr_zplug_install_plugin {
|
|
zplug ${1}
|
|
}
|
|
|
|
function __zspr_zplug_update_plugins {
|
|
zplug update
|
|
}
|
|
|
|
function __zspr_zplug_has_plugin {
|
|
zplug check ${1}
|
|
return $?
|
|
}
|
|
|
|
# Set up zplug as a plugin manager
|
|
ZSPR_PLM_FUNCTIONS[1]=__zspr_zplug_init
|
|
ZSPR_PLM_FUNCTIONS[2]=__zspr_zplug_load_plugins
|
|
ZSPR_PLM_FUNCTIONS[3]=__zspr_zplug_install_plugin
|
|
ZSPR_PLM_FUNCTIONS[4]=__zspr_zplug_update_plugins
|
|
ZSPR_PLM_FUNCTIONS[5]=__zspr_zplug_has_plugin
|