# load prompt functions setopt promptsubst setopt transient_rprompt # remove the pwd source ~/.zsh/.zvcs # signal names ZSIG=$(kill -l) ZSIG_MAX=$((128 + $(echo ${(s: :)ZSIG} | tr ' ' '\n' |wc -l) )) #hmm kill_consonant() { echo ${1//\.*/} } preexec() { } set_xprompt() { case $TERM in xterm*) echo -en "\033]0;$LOGNAME@$HOST\007" ;; esac } # set the prompt set_prompt() { [[ -n "$SSH_CLIENT" ]] && __ZH=" $HOST" mypath="$FX[reset]$FG[179]%~" # Special myjobs=() for a (${(k)jobstates}) {j=$jobstates[$a];i="${${(@s,:,)j}[2]}" myjobs+=($a${i//[^+-]/})} myjobs=${(j:,:)myjobs} ((MAXMID=$COLUMNS / 3)) # truncate to this value #psvar=( $history[$[${(%):-%h}-1]] ) case "${vcs_info_msg_1_}" in *svn*) alias svn=svn ;; *) alias svn=git ;; esac RPS1="$RPSL%$MAXMID<...<$mypath$RPSR$FG[239]$FX[bold]$__ZH$FX[reset]${vcs_info_msg_1_}" # Comment rehash set_xprompt } # print optional number of bg jobs (when 0 show nothing) # when the path is too long only the last section is shown # root is simple and all red # reset the colors when printing the rside prompt always # [[ -n "$SSH_CLIENT" ]] && __ZH=" $(kill_consonant $HOST)" PS1=$'${vcs_info_msg_0_}$FG[067]%(1j.$myjobs% $FX[reset].$FX[reset])$FG[179]%#$FX[reset] ' # 067 Statement RPSL=$'$FX[reset]' RPSR=$'$FX[reset]$FG[009]%(0?.$FG[reset]. $E)$FX[reset]' # Underlined RPS2=' <%^' precmd() { vcs_info # add the name of the signal if its there # must be done here in this function... EX=`print -P %?` # EX=$(print -P %?) # does not work... if [[ $EX -gt 128 && $EX -le $ZSIG_MAX ]]; then ((k=$EX-128)) E="-${${(s: :)ZSIG}[$k]}" else E=$EX fi set_prompt }