mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-24 04:29:25 +02:00
Merge remote-tracking branch 'upstream/master'
# Conflicts: # .gitignore
This commit is contained in:
commit
e027530ca5
60 changed files with 1813 additions and 268 deletions
|
|
@ -41,6 +41,8 @@ function _vi_status() {
|
|||
function _ruby_version() {
|
||||
if {echo $fpath | grep -q "plugins/rvm"}; then
|
||||
echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}"
|
||||
elif {echo $fpath | grep -q "plugins/rbenv"}; then
|
||||
echo "%{$fg[grey]%}$(rbenv_prompt_info)%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,38 +22,44 @@ bureau_git_branch () {
|
|||
echo "${ref#refs/heads/}"
|
||||
}
|
||||
|
||||
bureau_git_status () {
|
||||
bureau_git_status() {
|
||||
_STATUS=""
|
||||
if [[ $(command git status --short 2> /dev/null) != "" ]]; then
|
||||
_INDEX=$(command git status --porcelain -b 2> /dev/null)
|
||||
if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then
|
||||
|
||||
# check status of files
|
||||
_INDEX=$(command git status --porcelain 2> /dev/null)
|
||||
if [[ -n "$_INDEX" ]]; then
|
||||
if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then
|
||||
if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then
|
||||
if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then
|
||||
if $(echo "$_INDEX" | command grep -q '^UU '); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
|
||||
fi
|
||||
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
|
||||
fi
|
||||
else
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
|
||||
# check status of local repository
|
||||
_INDEX=$(command git status --porcelain -b 2> /dev/null)
|
||||
if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep -q '^## .*behind'); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
|
||||
fi
|
||||
|
||||
if $(command git rev-parse --verify refs/stash &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
|
||||
fi
|
||||
|
||||
echo $_STATUS
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ B=$fg_no_bold[blue]
|
|||
RESET=$reset_color
|
||||
|
||||
if [ "$USER" = "root" ]; then
|
||||
PROMPTCOLOR="%{$R%}" PREFIX="-!-";
|
||||
PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-";
|
||||
else
|
||||
PROMPTCOLOR="" PREFIX="---";
|
||||
PROMPTCOLOR="" PROMPTPREFIX="---";
|
||||
fi
|
||||
|
||||
local return_code="%(?..%{$R%}%? ↵%{$RESET%})"
|
||||
|
|
@ -66,7 +66,7 @@ function custom_git_prompt() {
|
|||
}
|
||||
|
||||
# %B sets bold text
|
||||
PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
|
||||
PROMPT='%B$PROMPTPREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
|
||||
RPS1="${return_code}"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$Y%}‹"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue