mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Default to old powerline and make configurable
This commit is contained in:
parent
8444a1a059
commit
3dad438312
1 changed files with 42 additions and 34 deletions
|
|
@ -26,7 +26,15 @@
|
||||||
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
||||||
|
|
||||||
CURRENT_BG='NONE'
|
CURRENT_BG='NONE'
|
||||||
SEGMENT_SEPARATOR=''
|
|
||||||
|
if [ "x$USE_NEW_POWERLINE" = "xtrue" ]; then
|
||||||
|
SEGMENT_SEPARATOR=''
|
||||||
|
BRANCH_SYMBOL=''
|
||||||
|
else
|
||||||
|
SEGMENT_SEPARATOR='⮀'
|
||||||
|
BRANCH_SYMBOL='⭠'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Begin a segment
|
# Begin a segment
|
||||||
# Takes two arguments, background and foreground. Both can be omitted,
|
# Takes two arguments, background and foreground. Both can be omitted,
|
||||||
|
|
@ -90,43 +98,43 @@ prompt_git() {
|
||||||
zstyle ':vcs_info:*' formats ' %u%c'
|
zstyle ':vcs_info:*' formats ' %u%c'
|
||||||
zstyle ':vcs_info:*' actionformats '%u%c'
|
zstyle ':vcs_info:*' actionformats '%u%c'
|
||||||
vcs_info
|
vcs_info
|
||||||
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}"
|
echo -n "${ref/refs\/heads\//$BRANCH_SYMBOL }${vcs_info_msg_0_}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_hg() {
|
prompt_hg() {
|
||||||
local rev status
|
local rev status
|
||||||
if $(hg id >/dev/null 2>&1); then
|
if $(hg id >/dev/null 2>&1); then
|
||||||
if $(hg prompt >/dev/null 2>&1); then
|
if $(hg prompt >/dev/null 2>&1); then
|
||||||
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||||
# if files are not added
|
# if files are not added
|
||||||
prompt_segment red white
|
prompt_segment red white
|
||||||
st='±'
|
st='±'
|
||||||
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||||
# if any modification
|
# if any modification
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
# if working copy is clean
|
# if working copy is clean
|
||||||
prompt_segment green black
|
prompt_segment green black
|
||||||
fi
|
fi
|
||||||
echo -n $(hg prompt "⭠ {rev}@{branch}") $st
|
echo -n $(hg prompt "$BRANCH_SYMBOL {rev}@{branch}") $st
|
||||||
else
|
else
|
||||||
st=""
|
st=""
|
||||||
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||||
branch=$(hg id -b 2>/dev/null)
|
branch=$(hg id -b 2>/dev/null)
|
||||||
if `hg st | grep -Eq "^\?"`; then
|
if `hg st | grep -Eq "^\?"`; then
|
||||||
prompt_segment red black
|
prompt_segment red black
|
||||||
st='±'
|
st='±'
|
||||||
elif `hg st | grep -Eq "^(M|A)"`; then
|
elif `hg st | grep -Eq "^(M|A)"`; then
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
prompt_segment green black
|
prompt_segment green black
|
||||||
fi
|
fi
|
||||||
echo -n "⭠ $rev@$branch" $st
|
echo -n "$BRANCH_SYMBOL $rev@$branch" $st
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Dir: current working directory
|
# Dir: current working directory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue