summaryrefslogtreecommitdiffstats
path: root/prompt_git_info
blob: 7950d21034a174bb81475b85f6538416a7c60b2b (plain)
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
#!/bin/zsh
#set -x
trap 'print -n ' INT

if [[ ! -z $__CURRENT_GIT_BRANCH ]]; then
    #echo "abcdefgh"
    local s="("
    s+="$__CURRENT_GIT_BRANCH"
    case "$__CURRENT_GIT_BRANCH_STATUS" in
        ahead)
        s+="↑"
        ;;
        diverged)
        s+="↕"
        ;;
        behind)
        s+="↓"
        ;;
    esac
    if [[ ! -z "$__CURRENT_GIT_BRANCH_IS_DIRTY" ]]; then
        s+="⚡"
    fi
    s+=")"

printf " %s%s" "%{${fg[yellow]}%}" $s
fi
#set +x