3 autoload colors && colors
9 git_dir=$(git rev-parse --git-dir 2> /dev/null) || return
10 if test -d "$git_dir/rebase-apply"; then
11 if test -f "$git_dir/rebase-apply/rebasing"; then
13 elif test -f "$git_dir/rebase-apply/applying"; then
18 branch="$(git symbolic-ref HEAD 2>/dev/null)"
19 elif test -f "$git_dir/rebase-merge/interactive"; then
21 branch="$(cat "$git_dir/rebase-merge/head-name")"
22 elif test -d "$git_dir/rebase-merge"; then
24 branch="$(cat "$git_dir/rebase-merge/head-name")"
25 elif test -f "$git_dir/MERGE_HEAD"; then
27 branch="$(git symbolic-ref HEAD 2>/dev/null)"
29 test -f "$git_dir/BISECT_LOG" && psvar[3]="bisect"
30 branch="$(git symbolic-ref HEAD 2>/dev/null)" || \
31 branch="$(git describe --exact-match HEAD 2>/dev/null)" || \
32 branch="$(cut -c1-7 "$git_dir/HEAD")..."
35 psvar[1]="${$(readlink -f ${git_dir:h})/$HOME/~}"
36 psvar[2]="${branch#refs/heads/}"
43 rst="%{$reset_color%}"
44 pcc[1]="%{$reset_color${1:-$fg_no_bold[green]}%}"
45 pcc[2]="%{$reset_color${2:-$fg_no_bold[yellow]}%}"
46 pcc[3]="%{$reset_color${3:-$fg_no_bold[cyan]}%}"
47 pcc[4]="%{$reset_color${4:-$fg_bold[red]}%}"
49 #%{$'\e[s\e[A\e[4Dblah\e[u'$reset_color%}
50 #%{$'\e[400C\e[20D'%}"────────────────────
52 $pcc[1]┌─(%B%T$pcc[1])──%(1v.<$pcc[3]%1v %B%U%2v%u%(3v.$pcc[4] <%3v>.)$pcc[1]>.)──
53 $pcc[1]└[$pcc[2]%{%(?..%S)%}%m%s$pcc[1]] $rst"
54 RPROMPT="$pcc[1](%B%~$pcc[1])$rst"
58 if [ $UID -eq 0 ]; then
59 PROMPT="%{$reset_color$fg_bold[yellow]%}[%{$fg_bold[red]%}%n %m%{$fg_bold[yellow]%}]%{$reset_color%} "
60 RPROMPT="%{$reset_color$fg_no_bold[red]%}(%{$fg_bold[red]%}%~%{$fg_no_bold[red]%})%{$reset_color%} "
67 PROMPT="${PROMPT}%{
\e]2;zsh
\a%}"
70 local CMD=${1[(wr)^(*=*|sudo|exec|-*)]}
71 echo -ne "\e]2;$CMD\007"