2015-12-15 06:12:17 +01:00
|
|
|
#
|
|
|
|
# Zim initializition
|
|
|
|
#
|
|
|
|
|
2017-06-28 23:55:48 +02:00
|
|
|
autoload -Uz is-at-least
|
|
|
|
if ! is-at-least 5.2; then
|
2017-07-31 01:24:58 +02:00
|
|
|
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
|
2017-06-28 23:55:48 +02:00
|
|
|
fi
|
|
|
|
|
2015-12-15 06:12:17 +01:00
|
|
|
# Define zim location
|
2017-09-26 19:28:08 +02:00
|
|
|
(( ! ${+ZIM_HOME} )) && export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
|
2015-12-15 06:12:17 +01:00
|
|
|
|
|
|
|
# Source user configuration
|
2017-09-26 19:28:08 +02:00
|
|
|
[[ -s ${ZDOTDIR:-${HOME}}/.zimrc ]] && source ${ZDOTDIR:-${HOME}}/.zimrc
|
2015-12-15 06:12:17 +01:00
|
|
|
|
2017-09-26 19:28:08 +02:00
|
|
|
# Autoload module functions
|
|
|
|
() {
|
2015-12-15 06:12:17 +01:00
|
|
|
local mod_function
|
2017-09-26 19:28:08 +02:00
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
2015-12-15 06:12:17 +01:00
|
|
|
|
|
|
|
# autoload searches fpath for function locations; add enabled module function paths
|
2017-09-26 19:28:08 +02:00
|
|
|
fpath=(${ZIM_HOME}/functions.zwc ${ZIM_HOME}/modules/prompt/functions ${fpath})
|
2015-12-15 06:12:17 +01:00
|
|
|
|
2017-09-26 19:28:08 +02:00
|
|
|
for mod_function in ${ZIM_HOME}/modules/${^zmodules}/functions/^([_.]*|prompt_*_setup|README*)(-.N:t); do
|
|
|
|
autoload -Uz ${mod_function}
|
|
|
|
done
|
2015-12-15 06:12:17 +01:00
|
|
|
}
|
|
|
|
|
2017-09-26 19:28:08 +02:00
|
|
|
# Initialize modules
|
|
|
|
() {
|
|
|
|
local zmodule
|
2015-12-15 06:12:17 +01:00
|
|
|
|
2017-09-26 19:28:08 +02: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
|
|
|
|
}
|