summaryrefslogtreecommitdiffstats
path: root/gitprompt
blob: f96c8d4731e2d886691e302fa24d443abee47ba0 (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
#!/bin/zsh
# detect git first

trap 'print -n;exit 1' INT
autoload -U colors && colors

estatus=0

#isgit="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
isgit="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
#if  test (../)#.git(N) 2>/dev/null;then
if  [[ $isgit == "true" ]];then
     local gprompt="("
     gprompt+="$(git branch | grep '*'| cut -d ' ' -f 2  | tr -d '\n')"
     #timeout 3 git status -s 
     if [[ -n $(timeout -s KILL 2 git status -s) ]];then 
         gprompt+="⚡"; 
         estatus=1
     else
         gprompt+="ʃ";
     fi
     gprompt+=")"
     printf " %s%s" "%{${fg[yellow]}%}" $gprompt "%{$reset_color%}"
fi

exit $estatus