mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
fixing the situation where no git status tags are shown producing ugly right-prompt
This commit is contained in:
parent
a3ff10265a
commit
46e0fb25aa
1 changed files with 8 additions and 3 deletions
|
|
@ -82,18 +82,23 @@ if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then
|
|||
fi
|
||||
fi
|
||||
}
|
||||
function my_git_prompt_status() {
|
||||
function my_git_prompt_status_and_time() {
|
||||
#wrap git prompt status with stuff
|
||||
NOW_GIT_PROMPT_STATUS="$(git_prompt_status)"
|
||||
NOW_GIT_TIME_SINCE="$(git_time_since_commit)"
|
||||
if [[ -n $NOW_GIT_PROMPT_STATUS ]]; then
|
||||
echo "%{$fg[grey]%}[$NOW_GIT_PROMPT_STATUS%{$fg[grey]%}]%{$reset_color%}"
|
||||
echo "%{$fg[grey]%}[$NOW_GIT_PROMPT_STATUS%{$fg[grey]%}]$NOW_GIT_TIME_SINCE%{$reset_color%}"
|
||||
else
|
||||
if [[ -n $NOW_GIT_TIME_SINCE ]]; then
|
||||
echo "%{$fg[grey]%}‖$NOW_GIT_TIME_SINCE%{$reset_color%}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# display exitcode on the right when >0
|
||||
return_code="%(?..%{$fg[magenta]%}%? ↲ %{$reset_color%}) "
|
||||
|
||||
RPROMPT='${return_code}$(git_prompt_info)$(git_prompt_short_sha)$(my_git_prompt_status)$(git_time_since_commit)%{$reset_color%}'
|
||||
RPROMPT='${return_code}$(git_prompt_info)$(git_prompt_short_sha)$(my_git_prompt_status_and_time)'
|
||||
|
||||
else
|
||||
PROMPT='[%n@%m:%~$(git_prompt_info)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue