Logic to generate the window title and RPROMPT has been yet optimized.
authorShingo W. Kagami
Sat, 23 Jan 2010 04:35:11 +0900
changeset 1176f664f2183e
parent 10 0afd98c7dab2
child 12 2840d13cb173
Logic to generate the window title and RPROMPT has been yet optimized.
.zshrc
     1.1 --- a/.zshrc	Sat Jan 23 03:39:07 2010 +0900
     1.2 +++ b/.zshrc	Sat Jan 23 04:35:11 2010 +0900
     1.3 @@ -46,9 +46,12 @@
     1.4  esac
     1.5  
     1.6  PROMPT=$'%{\e[35m%}%m%#%{\e[m%} '
     1.7 -precmd() { RPROMPT="[$PWD]" }
     1.8  
     1.9 -dirbase() { basename $PWD }
    1.10 -chpwd() { [ "x$TERM" = "xscreen" ] && echo -n "\ek`hostname | cut -b 1-3`:`dirbase`\e\\" }
    1.11 -
    1.12 -chpwd
    1.13 +HOST3=`hostname | cut -b 1-3`
    1.14 +precmd() {
    1.15 +    local PWD2=${PWD/#$HOME/\~}
    1.16 +    local DTRUN=$PWD2:t
    1.17 +    local DBASE=${DTRUN:-/}
    1.18 +    RPROMPT="[$PWD2]"
    1.19 +    [ "x$TERM" = "xscreen" ] && echo -n "\ek$HOST3:$DBASE\e\\"
    1.20 +}