Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
autoload -Uz colors && colors
setopt prompt_subst
prompt_symbol="✲"
green="%F{2}"
red="%F{1}"
promt_color="%F{11}"
function prompt_exit_status() {
if [ $? -eq 0 ]; then
echo "$green$prompt_symbol%{$reset_color%}"
else
echo "$red$prompt_symbol%{$reset_color%}"
fi
}
function prompt_git_branch() {
if git rev-parse --is-inside-work-tree &> /dev/null 2>&1; then
if git rev-parse HEAD &> /dev/null; then
local branch=$(git rev-parse --abbrev-ref HEAD)
if [[ $(git status) =~ "nothing to commit, working" ]]; then
echo -n "$green($branch)%{$reset_color%} "
else
echo -n "$red($branch)%{$reset_color%} "
fi
else
echo -n "${red}[EMPTY]%{$reset_color%} "
fi
fi
}
function prompt_directory() {
echo "$promt_color%~%{$reset_color%}"
}
function prompt_jobs() {
count=$( ( jobs ) | wc -l)
((count)) && echo -n "%F{250}[${count} hidden]%{$reset_color%} "
}
export PROMPT='$(prompt_exit_status) $(prompt_directory) $(prompt_jobs)$(prompt_git_branch)'