summaryrefslogtreecommitdiff
path: root/themes/agnoster.zsh-theme
diff options
context:
space:
mode:
Diffstat (limited to 'themes/agnoster.zsh-theme')
-rw-r--r--themes/agnoster.zsh-theme90
1 files changed, 49 insertions, 41 deletions
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index c7a59ad0d..8c7be6e01 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -6,7 +6,7 @@
# # README
#
# In order for this theme to render correctly, you will need a
-# [Powerline-patched font](https://gist.github.com/1595572).
+# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're
@@ -60,16 +60,16 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
prompt_context() {
- local user=`whoami`
-
- if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
- prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%m"
+ if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
+ prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
fi
}
# Git: branch/detached head, dirty status
prompt_git() {
- local ref dirty
+ local ref dirty mode repo_path
+ repo_path=$(git rev-parse --git-dir 2>/dev/null)
+
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
@@ -79,6 +79,14 @@ prompt_git() {
prompt_segment green black
fi
+ 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
@@ -88,45 +96,45 @@ prompt_git() {
zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:git:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c'
- zstyle ':vcs_info:*' actionformats '%u%c'
+ zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
- echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}"
+ 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
+ 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 -q "^\?"`; then
+ prompt_segment red black
+ st='±'
+ elif `hg st | grep -q "^(M|A)"`; then
+ prompt_segment yellow black
+ st='±'
+ else
+ prompt_segment green black
+ fi
+ echo -n "☿ $rev@$branch" $st
+ fi
+ fi
}
# Dir: current working directory
@@ -137,7 +145,7 @@ prompt_dir() {
# Virtualenv: current working virtualenv
prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"
- if [[ -n $virtualenv_path ]]; then
+ if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
prompt_segment blue black "(`basename $virtualenv_path`)"
fi
}