ff32968ba9
as discussed in #184. We'll first give users this warning message. A future update will replace this by an error. Also, starting at that update, a new branch will be created for users that still want to stick with zsh < 5.2. Closes #194
51 lines
1.3 KiB
Bash
Executable file
51 lines
1.3 KiB
Bash
Executable file
#
|
|
# Zim initializition
|
|
#
|
|
|
|
autoload -Uz is-at-least
|
|
if ! is-at-least 5.2; then
|
|
print "WARNING: Support for zsh < 5.2 will be removed in a future update. Update your version of zsh now to prevent any interruptions." >&2
|
|
fi
|
|
|
|
# Define zim location
|
|
ZIM="${ZDOTDIR:-${HOME}}/.zim"
|
|
|
|
# Source user configuration
|
|
if [[ -s "${ZDOTDIR:-${HOME}}/.zimrc" ]]; then
|
|
source "${ZDOTDIR:-${HOME}}/.zimrc"
|
|
fi
|
|
|
|
load_zim_module() {
|
|
local wanted_module
|
|
|
|
for wanted_module (${zmodules}); do
|
|
if [[ -s "${ZIM}/modules/${wanted_module}/init.zsh" ]]; then
|
|
source "${ZIM}/modules/${wanted_module}/init.zsh"
|
|
elif [[ ! -d "${ZIM}/modules/${wanted_module}" ]]; then
|
|
print "No such module \"${wanted_module}\"." >&2
|
|
fi
|
|
done
|
|
}
|
|
|
|
load_zim_function() {
|
|
local function_glob='^([_.]*|prompt_*_setup|README*)(-.N:t)'
|
|
local mod_function
|
|
|
|
# autoload searches fpath for function locations; add enabled module function paths
|
|
fpath=(${${zmodules}:+${ZIM}/modules/${^zmodules}/functions(/FN)} ${fpath})
|
|
|
|
function {
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
|
|
|
for mod_function in ${ZIM}/modules/${^zmodules}/functions/${~function_glob}; do
|
|
autoload -Uz ${mod_function}
|
|
done
|
|
}
|
|
}
|
|
|
|
# initialize zim modules
|
|
load_zim_function
|
|
load_zim_module
|
|
|
|
unset zmodules
|
|
unfunction load_zim_{module,function}
|