mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-26 23:00:30 +08:00
chore(async): reenable async prompt by default on zsh < 5.0.6 (#12358)
Fixes #12331
This commit is contained in:
parent
f78c6b90fc
commit
0c80a063c3
16
lib/git.zsh
16
lib/git.zsh
@ -39,21 +39,17 @@ function _omz_git_prompt_info() {
|
||||
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
||||
# Use async version if setting is enabled, or undefined but zsh version is at least 5.0.6
|
||||
# https://github.com/ohmyzsh/ohmyzsh/issues/12331#issuecomment-2059460268
|
||||
if zstyle -t ':omz:alpha:lib:git' async-prompt \
|
||||
|| { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
|
||||
# Use async version if setting is enabled or undefined
|
||||
if zstyle -T ':omz:alpha:lib:git' async-prompt; then
|
||||
function git_prompt_info() {
|
||||
setopt localoptions noksharrays
|
||||
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]" ]]; then
|
||||
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]"
|
||||
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then
|
||||
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}"
|
||||
fi
|
||||
}
|
||||
|
||||
function git_prompt_status() {
|
||||
setopt localoptions noksharrays
|
||||
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then
|
||||
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]"
|
||||
if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then
|
||||
echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user