2015-12-15 00:12:17 -05:00
|
|
|
#
|
|
|
|
# Zim initializition
|
|
|
|
#
|
|
|
|
|
|
|
|
# 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
|
2015-12-16 14:56:54 -05:00
|
|
|
fpath=(${argv:+${ZIM}/modules/${^zmodules}/functions(/FN)} ${fpath})
|
2015-12-15 00:12:17 -05:00
|
|
|
|
|
|
|
function {
|
|
|
|
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
|
|
|
|
|
|
|
for mod_function in ${ZIM}/modules/${^zmodules}/functions/$~function_glob; do
|
|
|
|
autoload -Uz ${mod_function}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Load zim functions
|
|
|
|
load_zim_function ${zmodules[@]}
|
|
|
|
|
|
|
|
# Load zim modules
|
|
|
|
load_zim_module ${zmodules[@]}
|
|
|
|
|
|
|
|
unset zmodules
|