1
0
Fork 0
mirror of synced 2024-06-01 06:41:12 -04:00
zimfw/src/stage2/31_zimfw_source_zimrc.zsh.erb
Eric Nielsen e54958b91c
Allow customizing .zimrc file path
with the ZIM_CONFIG_FILE environment variable.
Fixes #479.
2022-10-23 19:34:14 -05:00

21 lines
709 B
Plaintext

_zimfw_source_zimrc() {
local -r ztarget=${ZIM_CONFIG_FILE:-<%= home %>/.zimrc} _zflags=${1}
local -i _zfailed=0
if ! source ${ztarget} || (( _zfailed )); then
print -u2 -PR "%F{red}<%= failed %>Failed to source %B${ztarget}%b%f"
return 1
fi
if (( _zflags & 1 && ${#_znames} == 0 )); then
print -u2 -PR "%F{red}<%= failed %>No modules defined in %B${ztarget}%b%f"
return 1
fi
# Remove all from _zfpaths, _zfunctions and _zcmds with disabled root dirs prefixes
local zroot_dir zpre
for zroot_dir in ${_zdisabled_root_dirs}; do
zpre=${zroot_dir}$'\0'
_zfpaths=(${_zfpaths:#${zpre}*})
_zfunctions=(${_zfunctions:#${zpre}*})
_zcmds=(${_zcmds:#${zpre}*})
done
}