1
0
Fork 0
mirror of synced 2024-11-04 07:58:56 -05:00
zimfw/init.zsh

42 lines
1.1 KiB
Bash
Raw Normal View History

2015-12-15 00:12:17 -05:00
#
# Zim initializition
#
autoload -Uz is-at-least
if ! is-at-least 5.2; then
print "ERROR: Zim didn't start. You're using zsh version ${ZSH_VERSION}, and versions < 5.2 are not supported. Update your zsh." >&2
return 1
fi
2015-12-15 00:12:17 -05:00
# Define zim location
(( ! ${+ZIM_HOME} )) && export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
2015-12-15 00:12:17 -05:00
# Source user configuration
[[ -s ${ZDOTDIR:-${HOME}}/.zimrc ]] && source ${ZDOTDIR:-${HOME}}/.zimrc
2015-12-15 00:12:17 -05:00
# Autoload module functions
() {
2015-12-15 00:12:17 -05:00
local mod_function
setopt LOCAL_OPTIONS EXTENDED_GLOB
2015-12-15 00:12:17 -05:00
# autoload searches fpath for function locations; add enabled module function paths
fpath=(${ZIM_HOME}/functions.zwc ${ZIM_HOME}/modules/prompt/functions ${fpath})
2015-12-15 00:12:17 -05:00
for mod_function in ${ZIM_HOME}/modules/${^zmodules}/functions/^([_.]*|prompt_*_setup|README*)(-.N:t); do
autoload -Uz ${mod_function}
done
2015-12-15 00:12:17 -05:00
}
# Initialize modules
() {
local zmodule
2015-12-15 00:12:17 -05:00
for zmodule (${zmodules}); do
if [[ -s ${ZIM_HOME}/modules/${zmodule}/init.zsh ]]; then
source ${ZIM_HOME}/modules/${zmodule}/init.zsh
elif [[ ! -d ${ZIM_HOME}/modules/${zmodule} ]]; then
print "No such module \"${zmodule}\"." >&2
fi
done
}