Fixing segment seperator icons

This commit is contained in:
Clark Tomlinson 2014-04-24 14:35:43 -04:00
commit 89b24d4335

View file

@ -1,3 +1,4 @@
# vim:ft=zsh ts=2 sw=2 sts=2 # vim:ft=zsh ts=2 sw=2 sts=2
# #
# agnoster's Theme - https://gist.github.com/3712874 # agnoster's Theme - https://gist.github.com/3712874
@ -6,7 +7,7 @@
# # README # # README
# #
# In order for this theme to render correctly, you will need a # In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). # [Powerline-patched font](https://gist.github.com/1595572).
# #
# In addition, I recommend the # In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're # [Solarized theme](https://github.com/altercation/solarized/) and, if you're
@ -26,7 +27,7 @@
# 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='' SEGMENT_SEPARATOR=''
# 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,
@ -69,10 +70,9 @@ prompt_context() {
# Git: branch/detached head, dirty status # Git: branch/detached head, dirty status
prompt_git() { prompt_git() {
local ref dirty mode repo_path local ref dirty
repo_path=$(git rev-parse --git-dir 2>/dev/null)
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
ZSH_THEME_GIT_PROMPT_DIRTY='±'
dirty=$(parse_git_dirty) dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
if [[ -n $dirty ]]; then if [[ -n $dirty ]]; then
@ -80,62 +80,7 @@ prompt_git() {
else else
prompt_segment green black prompt_segment green black
fi fi
echo -n "${ref/refs\/heads\//⭠ }$dirty"
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
mode=" >M<"
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
mode=" >R>"
fi
setopt promptsubst
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:git:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }${mode}"
fi
}
prompt_hg() {
local rev status
if $(hg id >/dev/null 2>&1); then
if $(hg prompt >/dev/null 2>&1); then
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
# if files are not added
prompt_segment red white
st='±'
elif [[ -n $(hg prompt "{status|modified}") ]]; then
# if any modification
prompt_segment yellow black
st='±'
else
# if working copy is clean
prompt_segment green black
fi
echo -n $(hg prompt "☿ {rev}@{branch}") $st
else
st=""
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
branch=$(hg id -b 2>/dev/null)
if `hg st | grep -Eq "^\?"`; then
prompt_segment red black
st='±'
elif `hg st | grep -Eq "^(M|A)"`; then
prompt_segment yellow black
st='±'
else
prompt_segment green black
fi
echo -n "☿ $rev@$branch" $st
fi
fi fi
} }
@ -144,14 +89,6 @@ prompt_dir() {
prompt_segment blue black '%~' prompt_segment blue black '%~'
} }
# Virtualenv: current working virtualenv
prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
prompt_segment blue black "(`basename $virtualenv_path`)"
fi
}
# Status: # Status:
# - was there an error # - was there an error
# - am I root # - am I root
@ -170,11 +107,9 @@ prompt_status() {
build_prompt() { build_prompt() {
RETVAL=$? RETVAL=$?
prompt_status prompt_status
prompt_virtualenv
prompt_context prompt_context
prompt_dir prompt_dir
prompt_git prompt_git
prompt_hg
prompt_end prompt_end
} }