summaryrefslogtreecommitdiff
path: root/plugins/zsh_reload
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2020-08-28 10:02:23 -0600
committerTuowen Zhao <ztuowen@gmail.com>2020-08-28 10:02:23 -0600
commit8620d4004c3391fa4f624ebf500eef8bcf32a52e (patch)
treec8d6dcc080733bf63aec4acaf3257a7400da1bb3 /plugins/zsh_reload
parentf672613e98ba6b30728517b22c0e378557d7fb81 (diff)
parent8d08f1634a7b9782e3722ce770e8630f569afe3f (diff)
downloadzsh-8620d4004c3391fa4f624ebf500eef8bcf32a52e.tar.gz
zsh-8620d4004c3391fa4f624ebf500eef8bcf32a52e.tar.bz2
zsh-8620d4004c3391fa4f624ebf500eef8bcf32a52e.zip
Merge remote-tracking branch 'origin/master' into master
Diffstat (limited to 'plugins/zsh_reload')
-rw-r--r--plugins/zsh_reload/zsh_reload.plugin.zsh14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/zsh_reload/zsh_reload.plugin.zsh b/plugins/zsh_reload/zsh_reload.plugin.zsh
index 83f8da733..0d29a7ce3 100644
--- a/plugins/zsh_reload/zsh_reload.plugin.zsh
+++ b/plugins/zsh_reload/zsh_reload.plugin.zsh
@@ -7,6 +7,16 @@ src() {
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
}