34 lines
850 B
Bash
34 lines
850 B
Bash
prompt_command() {
|
|
retval=$?
|
|
branch="";
|
|
clean="";
|
|
|
|
numcolor="\[\e[0;33m\]"
|
|
red="\[\e[0;31m\]"
|
|
sepcolor="\[\e[1;30m\]"
|
|
yellow="\[\e[0;33m\]"
|
|
brightyellow="\[\e[1;33m\]"
|
|
brightblue="\[\e[1;34m\]"
|
|
default="\[\e[0m\]"
|
|
green="\[\e[0;32m\]"
|
|
|
|
if [[ $retval != 0 ]]; then
|
|
numcolor="\[\e[1;41;33m\]"
|
|
fi
|
|
|
|
if git branch &>/dev/null; then
|
|
branch="$green$(git branch 2>/dev/null | grep \* | cut -d ' ' -f 2-)"
|
|
clean=$(git status | grep clean)
|
|
if [ -z "$clean" ]; then clean="${red}✗"; else clean=""; fi
|
|
fi
|
|
|
|
PS1="${debian_chroot:+($debian_chroot)}$numcolor\!$red \u$sepcolor@${brightblue}\h${default}:${branch}${clean} $default\w$green\$${default} "
|
|
|
|
unset clean numcolor branch retval
|
|
}
|
|
|
|
PROMPT_COMMAND=prompt_command
|
|
|
|
eval "$(thefuck --alias fixit)"
|
|
set -o vi
|