1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 01:33:50 +08:00

fix(essembeh): use async prompt (#12512)

This commit is contained in:
Sébastien MB 2024-06-17 21:38:21 +02:00 committed by GitHub
parent 7e4ee3a3cd
commit 373a1fd585
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,21 +11,7 @@
# git plugin
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
ZSH_THEME_GIT_PROMPT_ADDED="+"
ZSH_THEME_GIT_PROMPT_MODIFIED="*"
ZSH_THEME_GIT_PROMPT_RENAMED="~"
ZSH_THEME_GIT_PROMPT_DELETED="!"
ZSH_THEME_GIT_PROMPT_UNMERGED="?"
function zsh_essembeh_gitstatus {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
GIT_STATUS=$(git_prompt_status)
if [[ -n $GIT_STATUS ]]; then
GIT_STATUS=" $GIT_STATUS"
fi
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
# by default, use green for user@host and no prefix
local ZSH_ESSEMBEH_COLOR="green"
@ -46,5 +32,5 @@ if [[ $UID = 0 ]]; then
# always use magenta for root sessions, even in ssh
ZSH_ESSEMBEH_COLOR="magenta"
fi
PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(zsh_essembeh_gitstatus)%(!.#.$) '
PROMPT='${ZSH_ESSEMBEH_PREFIX}%{$fg[$ZSH_ESSEMBEH_COLOR]%}%n@%M%{$reset_color%}:%{%B$fg[yellow]%}%~%{$reset_color%b%} $(git_prompt_info)%(!.#.$) '
RPROMPT="%(?..%{$fg[red]%}%?%{$reset_color%})"