diff --git a/lib/async_prompt.zsh b/lib/async_prompt.zsh index dfd895734..c6d03328b 100644 --- a/lib/async_prompt.zsh +++ b/lib/async_prompt.zsh @@ -25,15 +25,16 @@ zmodload zsh/system # This API is subject to change and optimization. Rely on it at your own risk. function _omz_register_handler { + setopt localoptions noksharrays typeset -ga _omz_async_functions # we want to do nothing if there's no $1 function or we already set it up if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \ - || (( ${+_omz_async_functions[$1]} )); then + || (( ${_omz_async_functions[(Ie)$1]} )); then return fi _omz_async_functions+=("$1") # let's add the hook to async_request if it's not there yet - if (( ! ${+precmd_functions[_omz_async_request]} )) \ + if (( ! ${precmd_functions[(Ie)_omz_async_request]} )) \ && (( ${+functions[_omz_async_request]})); then autoload -Uz add-zsh-hook add-zsh-hook precmd _omz_async_request diff --git a/lib/git.zsh b/lib/git.zsh index ec1d09d1b..6f4823458 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -39,8 +39,6 @@ function _omz_git_prompt_status() { # Enable async prompt by default unless the setting is at false / no if zstyle -T ':omz:alpha:lib:git' async-prompt; then - _omz_async_functions+=(_omz_git_prompt_status) - function git_prompt_info() { _omz_register_handler _omz_git_prompt_status if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then