summaryrefslogtreecommitdiff
path: root/plugins/zsh_reload
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/zsh_reload')
-rw-r--r--plugins/zsh_reload/zsh_reload.plugin.zsh16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/zsh_reload/zsh_reload.plugin.zsh b/plugins/zsh_reload/zsh_reload.plugin.zsh
index 51048ba9d..0d29a7ce3 100644
--- a/plugins/zsh_reload/zsh_reload.plugin.zsh
+++ b/plugins/zsh_reload/zsh_reload.plugin.zsh
@@ -3,10 +3,20 @@ src() {
autoload -U compinit zrecompile
compinit -i -d "$cache/zcomp-$HOST"
- for f in ~/.zshrc "$cache/zcomp-$HOST"; do
+ for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done
- # Use $SHELL if available; remove leading dash if login shell
- [[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
+ # Use $SHELL if it's available and a zsh shell
+ local shell="$ZSH_ARGZERO"
+ if [[ "${${SHELL:t}#-}" = zsh ]]; then
+ shell="$SHELL"
+ fi
+
+ # Remove leading dash if login shell and run accordingly
+ if [[ "${shell:0:1}" = "-" ]]; then
+ exec -l "${shell#-}"
+ else
+ exec "$shell"
+ fi
}