2014-04-22 18:09:27 -07:00
|
|
|
autoload -U colors && colors
|
2014-04-08 04:25:57 -07:00
|
|
|
function current_directory() {
|
|
|
|
local PWD=$(pwd)
|
|
|
|
echo "${PWD/#$HOME/~}"
|
|
|
|
}
|
|
|
|
|
2014-04-08 11:00:25 -07:00
|
|
|
function git_prompt_info() {
|
2014-04-13 22:47:40 -07:00
|
|
|
if test -z $(git branch-or-sha);
|
2014-04-08 04:25:57 -07:00
|
|
|
then
|
|
|
|
echo ""
|
|
|
|
else
|
2014-04-13 23:37:19 -07:00
|
|
|
echo " %{$FG[239]%}on%{$reset_color%} %{$FG[255]%}$(git branch-or-sha)%{$reset_color%}$(git_status_character)"
|
2014-04-08 04:25:57 -07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-08 11:00:25 -07:00
|
|
|
function git_status_character() {
|
2014-04-14 20:24:52 -07:00
|
|
|
if git dirty;
|
2014-04-08 11:00:25 -07:00
|
|
|
then
|
|
|
|
echo "%{$FG[202]%}✘%{$reset_color%}"
|
|
|
|
else
|
|
|
|
echo "%{$FG[040]%}✔%{$reset_color%}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function sandbox_prompt() {
|
2014-04-08 11:55:55 -07:00
|
|
|
if [ ! -z "$(sandbox_prompt_info)" ];
|
2014-04-08 11:00:25 -07:00
|
|
|
then
|
|
|
|
echo " %{$FG[239]%}with $(colored_sandbox_string)%{$reset_color%}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-24 20:13:35 -07:00
|
|
|
function prompt_use_custom_colors() {
|
|
|
|
export USERNAME_COLOR="$FG[040]"
|
|
|
|
export SEPARATOR_COLOR="$FG[239]"
|
|
|
|
export HOSTNAME_COLOR="$FG[033]"
|
|
|
|
export CURRENT_DIRECTORY_COLOR="$FG[226]"
|
|
|
|
}
|
|
|
|
|
|
|
|
function prompt_use_basic_colors() {
|
|
|
|
export USERNAME_COLOR="$fg[blue]"
|
|
|
|
export SEPARATOR_COLOR="$fg[black]"
|
|
|
|
export HOSTNAME_COLOR="$fg[green]"
|
|
|
|
export CURRENT_DIRECTORY_COLOR="$fg[yellow]"
|
|
|
|
}
|
|
|
|
|
|
|
|
function prompt_grey_separator() {
|
|
|
|
export USERNAME_COLOR="$fg[blue]"
|
|
|
|
export SEPARATOR_COLOR="$FG[239]"
|
|
|
|
export HOSTNAME_COLOR="$fg[green]"
|
|
|
|
export CURRENT_DIRECTORY_COLOR="$fg[yellow]"
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_with_color() {
|
|
|
|
echo "%{$2%}$1%{$reset_color%}"
|
|
|
|
}
|
|
|
|
|
|
|
|
function separator() {
|
|
|
|
print_with_color "$1" "$SEPARATOR_COLOR"
|
|
|
|
}
|
|
|
|
|
|
|
|
PROMPT='╭─% $(print_with_color "%n" "$USERNAME_COLOR") $(separator "at") $(print_with_color "`hostname -s`" "$HOSTNAME_COLOR") $(separator "in") $(print_with_color "`current_directory`" "$terminfo[bold]$CURRENT_DIRECTORY_COLOR")$(git_prompt_info)$(sandbox_prompt)
|
|
|
|
╰─± '
|
2014-04-08 05:56:26 -07:00
|
|
|
|
2014-04-24 20:20:19 -07:00
|
|
|
PS2='(%_) '
|
2014-04-08 05:56:26 -07:00
|
|
|
|
2014-04-13 22:04:55 -07:00
|
|
|
RPROMPT='Last Exit Code: $?'
|
2014-04-24 20:13:35 -07:00
|
|
|
prompt_use_custom_colors
|