summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.zsh23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh
index edc10e722..e7f997013 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -105,7 +105,10 @@ function _omz {
return 0
}
-compdef _omz omz
+# If run from a script, do not set the completion function
+if (( ${+functions[compdef]} )); then
+ compdef _omz omz
+fi
## Utility functions
@@ -299,10 +302,8 @@ multi == 1 && length(\$0) > 0 {
# Restart the zsh session if there were no errors
_omz::log info "plugins disabled: ${(j:, :)dis_plugins}."
- # Old zsh versions don't have ZSH_ARGZERO
- local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
- # Check whether to run a login shell
- [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
+ # Only reload zsh if run in an interactive session
+ [[ ! -o interactive ]] || _omz::reload
}
function _omz::plugin::enable {
@@ -375,10 +376,8 @@ multi == 1 && /^[^#]*\)/ {
# Restart the zsh session if there were no errors
_omz::log info "plugins enabled: ${(j:, :)add_plugins}."
- # Old zsh versions don't have ZSH_ARGZERO
- local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
- # Check whether to run a login shell
- [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
+ # Only reload zsh if run in an interactive session
+ [[ ! -o interactive ]] || _omz::reload
}
function _omz::plugin::info {
@@ -731,10 +730,8 @@ EOF
# Restart the zsh session if there were no errors
_omz::log info "'$1' theme set correctly."
- # Old zsh versions don't have ZSH_ARGZERO
- local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
- # Check whether to run a login shell
- [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
+ # Only reload zsh if run in an interactive session
+ [[ ! -o interactive ]] || _omz::reload
}
function _omz::theme::use {