plugin.zsh: Standard $0 handling and $fpath extending

This commit is contained in:
Sebastian Gniazdowski 2020-01-25 00:55:07 +01:00
parent d343cd0d7f
commit 71e00938a7

View file

@ -7,10 +7,16 @@
# to ~/.zshrc. # to ~/.zshrc.
# #
0="${(%):-%N}" # this gives immunity to functionargzero being unset # According to the standard:
HSMW_REPO_DIR="${0%/*}" # http://zdharma.org/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
if [[ -z "$ZPLG_CUR_PLUGIN" && "${fpath[(r)$HSMW_REPO_DIR]}" != $HSMW_REPO_DIR ]]; then 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
fpath+=( "$HSMW_REPO_DIR" ) 0="${${(M)0:#/*}:-$PWD/$0}"
HSMW_REPO_DIR="${0:h}"
if [[ ${zsh_loaded_plugins[-1]} != */history-search-multi-word && -z ${fpath[(r)${0:h}]} ]]
then
fpath+=( "${0:h}" )
fi fi
autoload history-search-multi-word hsmw-context-main autoload history-search-multi-word hsmw-context-main