2013-03-07 00:58:05 -08:00
|
|
|
#!/bin/bash
|
2013-03-03 05:49:37 -08:00
|
|
|
|
2013-03-16 11:29:30 -07:00
|
|
|
function short_pwd() {
|
|
|
|
SHORTPWD=`print -Pn "%4~"`
|
|
|
|
[[ "${SHORT_PWD:0:1}" =~ "[^/~]" ]] && SHORT_PWD=".../$SHORT_PWD"
|
2013-03-20 16:55:09 -07:00
|
|
|
echo -n $SHORTPWD
|
|
|
|
}
|
2013-03-16 11:29:30 -07:00
|
|
|
|
2013-03-20 16:55:09 -07:00
|
|
|
function git_prompt() {
|
|
|
|
if [ "`git_prompt_info`" ]; then
|
|
|
|
echo -n "$(git_prompt_info)"
|
|
|
|
fi
|
2013-03-16 11:29:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
# GIT Stuff
|
2013-03-20 16:55:09 -07:00
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX=" :%{$fg[white]%}"
|
2013-03-16 11:29:30 -07:00
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
|
|
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}+%{$fg[white]%}"
|
2013-03-20 16:55:09 -07:00
|
|
|
# ZSH_THEME_GIT_PROMPT_CLEAN=""
|
2013-03-16 11:29:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
##################
|
|
|
|
# Build Prompt #
|
|
|
|
##################
|
|
|
|
|
2013-03-20 16:55:09 -07:00
|
|
|
prompt() {
|
|
|
|
echo -n "%{$fg[red]%}"
|
|
|
|
echo -n "%{$FX[bold]%}"
|
|
|
|
|
|
|
|
# Show the hostname if this is an SSH session
|
|
|
|
if [[ -n $SSH_CLIENT ]]; then
|
|
|
|
echo -n "$(hostname) "
|
|
|
|
fi
|
|
|
|
|
|
|
|
# The prompt
|
|
|
|
echo -n "\$ %{$FX[no-bold]%}"
|
|
|
|
}
|
|
|
|
|
|
|
|
rprompt() {
|
|
|
|
# Make the rprompt a bright grey to set it apart
|
|
|
|
echo -n "%{$FG[245]%}"
|
|
|
|
echo -n '$(short_pwd)'
|
|
|
|
|
|
|
|
# Show the branch/status if in a git repo
|
|
|
|
echo -n '$(git_prompt)'
|
|
|
|
|
|
|
|
# Reset formatting for command output
|
|
|
|
echo -n "%{$reset_color%}"
|
|
|
|
}
|
|
|
|
|
|
|
|
PROMPT="$(prompt)"
|
|
|
|
RPROMPT="$(rprompt)"
|