mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
added faster git time status to roymuse
This commit is contained in:
parent
a792efcaa3
commit
fdc2acba61
1 changed files with 13 additions and 8 deletions
|
|
@ -13,8 +13,8 @@ GIT_DIRTY_COLOR=$FG[133]
|
||||||
GIT_CLEAN_COLOR=$FG[118]
|
GIT_CLEAN_COLOR=$FG[118]
|
||||||
GIT_PROMPT_INFO=$FG[012]
|
GIT_PROMPT_INFO=$FG[012]
|
||||||
|
|
||||||
PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} '
|
PROMPT='╭─%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_time_since_commit)$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}
|
||||||
RPROMPT='$(git_time_since_commit)'
|
╰─ᐅ%{$reset_color%} '
|
||||||
|
|
||||||
#RPS1="${return_code}"
|
#RPS1="${return_code}"
|
||||||
|
|
||||||
|
|
@ -44,6 +44,14 @@ function rvm_gemset() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function minutes_since_last_commit {
|
||||||
|
now=`date +%s`
|
||||||
|
last_commit=`git log --pretty=format:'%at' -1`
|
||||||
|
seconds_since_last_commit=$((now-last_commit))
|
||||||
|
minutes_since_last_commit=$((seconds_since_last_commit/60))
|
||||||
|
echo $minutes_since_last_commit
|
||||||
|
}
|
||||||
# Determine the time since last commit. If branch is clean,
|
# Determine the time since last commit. If branch is clean,
|
||||||
# use a neutral color, otherwise colors will vary according to time.
|
# use a neutral color, otherwise colors will vary according to time.
|
||||||
function git_time_since_commit() {
|
function git_time_since_commit() {
|
||||||
|
|
@ -77,15 +85,12 @@ function git_time_since_commit() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$HOURS" -gt 24 ]; then
|
if [ "$HOURS" -gt 24 ]; then
|
||||||
echo "|$(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
|
echo "|$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
|
||||||
elif [ "$MINUTES" -gt 60 ]; then
|
elif [ "$MINUTES" -gt 60 ]; then
|
||||||
echo "|$(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
|
echo "|$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
|
||||||
else
|
else
|
||||||
echo "|$(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|"
|
echo "|$COLOR${MINUTES}m%{$reset_color%}|"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
|
|
||||||
echo "|$(rvm_gemset)$COLOR~|"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue