mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-10-16 11:40:46 +00:00
fix
This commit is contained in:
parent
11195dbe04
commit
895ce66630
2 changed files with 3 additions and 4 deletions
|
@ -25,15 +25,16 @@ zmodload zsh/system
|
||||||
# This API is subject to change and optimization. Rely on it at your own risk.
|
# This API is subject to change and optimization. Rely on it at your own risk.
|
||||||
|
|
||||||
function _omz_register_handler {
|
function _omz_register_handler {
|
||||||
|
setopt localoptions noksharrays
|
||||||
typeset -ga _omz_async_functions
|
typeset -ga _omz_async_functions
|
||||||
# we want to do nothing if there's no $1 function or we already set it up
|
# we want to do nothing if there's no $1 function or we already set it up
|
||||||
if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
|
if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
|
||||||
|| (( ${+_omz_async_functions[$1]} )); then
|
|| (( ${_omz_async_functions[(Ie)$1]} )); then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
_omz_async_functions+=("$1")
|
_omz_async_functions+=("$1")
|
||||||
# let's add the hook to async_request if it's not there yet
|
# 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
|
&& (( ${+functions[_omz_async_request]})); then
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
add-zsh-hook precmd _omz_async_request
|
add-zsh-hook precmd _omz_async_request
|
||||||
|
|
|
@ -39,8 +39,6 @@ function _omz_git_prompt_status() {
|
||||||
|
|
||||||
# Enable async prompt by default unless the setting is at false / no
|
# Enable async prompt by default unless the setting is at false / no
|
||||||
if zstyle -T ':omz:alpha:lib:git' async-prompt; then
|
if zstyle -T ':omz:alpha:lib:git' async-prompt; then
|
||||||
_omz_async_functions+=(_omz_git_prompt_status)
|
|
||||||
|
|
||||||
function git_prompt_info() {
|
function git_prompt_info() {
|
||||||
_omz_register_handler _omz_git_prompt_status
|
_omz_register_handler _omz_git_prompt_status
|
||||||
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then
|
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue