3 # Below are the color init strings for the basic file types. A color init
 
   4 # string consists of one or more of the following numeric codes:
 
   6 # 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
 
   8 # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
 
   9 # Background color codes:
 
  10 # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
 
  14     (( TERMWIDTH = ${COLUMNS} - 1 ))
 
  18     # Truncate the path if it's too long.
 
  23     local promptsize=${#${(%):---(%n@%M:%l)---()}}
 
  24     local pwdsize=${#${(%):-%~}}
 
  25     local gitbranch="$(git_prompt_info)"
 
  26     local rvmprompt="$(rvm_prompt_info)"
 
  27     local gitbranchsize=${#${gitbranch:-''}}
 
  28     local rvmpromptsize=${#${rvmprompt:-''}}
 
  30     if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then
 
  31         ((PR_PWDLEN=$TERMWIDTH - $promptsize))
 
  33         PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}"
 
  41     if [[ "$TERM" == "screen" ]]; then
 
  42         local CMD=${1[(wr)^(*=*|sudo|-*)]}
 
  46     if [[ "$TERM" == "xterm" ]]; then
 
  50     if [[ "$TERM" == "rxvt" ]]; then
 
  58 # Need this so the prompt will work.
 
  64 # See if we can use colors.
 
  66     autoload colors zsh/terminfo
 
  67     if [[ "$terminfo[colors]" -ge 8 ]]; then
 
  70     for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
 
  71     eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
 
  72     eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
 
  73     (( count = $count + 1 ))
 
  75     PR_NO_COLOUR="%{$terminfo[sgr0]%}"
 
  79 # See if we can use extended characters to look nicer.
 
  82 #    set -A altchar "${(s..)terminfo[acsc]}"
 
  83     PR_SET_CHARSET="%{$terminfo[enacs]%}"
 
  84     PR_HBAR=${altchar[q]:--}
 
  85     PR_ULCORNER=${altchar[l]:--}
 
  86     PR_LLCORNER=${altchar[m]:--}
 
  87     PR_LRCORNER=${altchar[j]:--}
 
  88     PR_URCORNER=${altchar[k]:--}
 
  92     ZSH_THEME_GIT_PROMPT_PREFIX=" ["
 
  93     ZSH_THEME_GIT_PROMPT_SUFFIX="]"
 
  96     ZSH_THEME_RVM_PROMPT_PREFIX=" ["
 
  97     ZSH_THEME_RVM_PROMPT_SUFFIX="]"
 
 101 # Decide if we need to set titlebar text.
 
 105         PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}'
 
 108         PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
 
 117 # Decide whether to set a screen title
 
 118     if [[ "$TERM" == "screen" ]]; then
 
 119         PR_STITLE=$'%{\ekzsh\e\\%}'
 
 125 # Finally, the prompt.
 
 127     PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
 
 129 $PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\
 
 130 $PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\
 
 132 $PR_GREEN%l$PR_RED>$PR_HBAR\
 
 135 %(?..$PR_LIGHT_RED%?$PR_BLUE:)\
 
 136 $PR_LIGHT_BLUE%(!.$PR_RED.$PR_WHITE)%#$PR_RED>$PR_HBAR\