public
Created

  • Download Gist
.zshrc
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#!/usr/bin/env zsh
function __richo_pwd()
{
local current=$PWD
richo_prompt=no
if [ -e ".svn" ]; then
export richo_prompt="⚡"
fi
while [ "$current" != '/' -a $richo_prompt = "no" ]; do
# for n in n; do
if [ -e "$current/.git" ]; then
export richo_prompt="±"
break
fi
if [ -e "$current/.hg" ]; then
export richo_prompt="☿"
break
fi
if [ -e "$current/.bzr" ]; then
export richo_prompt="⤴"
break
fi
current=$current:h
done
if [ $richo_prompt != "no" ]; then
if [ "$current" = "$HOME" ]; then
repo="~"
suff=${PWD##$current}
export richo_pwd="$PR_BRIGHT_WHITE${repo}$PR_BRIGHT_BLUE$suff"
else
pref=$current:h
suff=${PWD##$current}
repo=$current:t
richo_pwd="$pref/$PR_DULL_WHITE${repo}$PR_BRIGHT_BLUE$suff"
export richo_pwd=${richo_pwd/$HOME/\~}
fi
else
export richo_prompt='%#'
export richo_pwd="${PWD/$HOME/~}"
fi
}
__richo_pwd
add-zsh-hook chpwd __richo_pwd
PS1="${SHELL_COLOR}%(?.%m.\$(__richo_host) $PR_BRIGHT_RED%?)%b $PR_BRIGHT_BLUE\$richo_prompt $PR_RESET"
RPS1="$PR_BRIGHT_BLUE\$richo_pwd "

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.