comparison .shell.d/99.prompt.zsh @ 179:ebbbf3567a0e

zsh prompt: detabify
author Augie Fackler <durin42@gmail.com>
date Wed, 13 Jan 2010 10:34:12 -0600
parents da329720ff18
children e189dfb33bfa
comparison
equal deleted inserted replaced
178:da329720ff18 179:ebbbf3567a0e
4 # DANGER replacing the date 4 # DANGER replacing the date
5 # failed jobs print exit status in the RPS1 with yellow text 5 # failed jobs print exit status in the RPS1 with yellow text
6 setopt prompt_subst 6 setopt prompt_subst
7 7
8 preexec () { 8 preexec () {
9 currJob="`echo $3 | cut -d ' ' -f 1 | head -n 1`" 9 currJob="`echo $3 | cut -d ' ' -f 1 | head -n 1`"
10 if [[ "$TERM" == "screen" ]]; then 10 if [[ "$TERM" == "screen" ]]; then
11 hostUser="%10<...<%~%<<" 11 hostUser="%10<...<%~%<<"
12 print -Pn "\ek[$hostUser $currJob]\e\\" 12 print -Pn "\ek[$hostUser $currJob]\e\\"
13 else 13 else
14 if [[ "$FANCYTYPE" == "YES" ]]; then 14 if [[ "$FANCYTYPE" == "YES" ]]; then
15 hostUser="%n@%m: %2~" 15 hostUser="%n@%m: %2~"
16 print -Pn "\e]0;$hostUser [$currJob]\a" 16 print -Pn "\e]0;$hostUser [$currJob]\a"
17 fi 17 fi
18 fi 18 fi
19 } 19 }
20 20
21 function right_side_prompt() { 21 function right_side_prompt() {
22 branch=`vcs_current_branch` 22 branch=`vcs_current_branch`
23 if [ $? = 0 ] ; then 23 if [ $? = 0 ] ; then
30 function precmd () { 30 function precmd () {
31 rps_branch=`right_side_prompt` 31 rps_branch=`right_side_prompt`
32 } 32 }
33 33
34 if [ "x`whoami`" = "xroot" ] ; then 34 if [ "x`whoami`" = "xroot" ] ; then
35 PS1=$'%{\e];%n@%m: %2~ [zsh]\a%}[%m:%3~] %{\e[31m%}%n%{\e[0m%}%# ' 35 PS1=$'%{\e];%n@%m: %2~ [zsh]\a%}[%m:%3~] %{\e[31m%}%n%{\e[0m%}%# '
36 if [[ "$TERM" == "screen" ]] ; then 36 if [[ "$TERM" == "screen" ]] ; then
37 PS1=$'%{\ek[%2~ zsh]\e\\%}[%m:%3~] %{\e[31m%}%n%{\e[0m%}%# ' 37 PS1=$'%{\ek[%2~ zsh]\e\\%}[%m:%3~] %{\e[31m%}%n%{\e[0m%}%# '
38 fi 38 fi
39 RPS1=$'%{\e[1;35m%}[DANGER %t]%{\e[0m%}%(?..%{\e[1;33m%} %?%{\e[1;0m%})' 39 RPS1=$'%{\e[1;35m%}[DANGER %t]%{\e[0m%}%(?..%{\e[1;33m%} %?%{\e[1;0m%})'
40 else 40 else
41 PS1=$'%{\e];%n@%m: %2~ [zsh]\a%}[%m:%3~] %{\e[34m%}%n%{\e[0m%}%# ' 41 PS1=$'%{\e];%n@%m: %2~ [zsh]\a%}[%m:%3~] %{\e[34m%}%n%{\e[0m%}%# '
42 if [[ "$TERM" == "screen" ]]; then 42 if [[ "$TERM" == "screen" ]]; then
43 PS1=$'%{\ek[%2~ zsh]\e\\%}[%m:%3~] %{\e[34m%}%n%{\e[0m%}%# ' 43 PS1=$'%{\ek[%2~ zsh]\e\\%}[%m:%3~] %{\e[34m%}%n%{\e[0m%}%# '
44 fi 44 fi
45 RPS1=$'[$rps_branch]%(?..%{\e[1;33m%} %?%{\e[0m%})' 45 RPS1=$'[$rps_branch]%(?..%{\e[1;33m%} %?%{\e[0m%})'
46 fi 46 fi
47 47
48 48
49 export FANCYTYPE="NO" 49 export FANCYTYPE="NO"