summaryrefslogtreecommitdiffstats
path: root/gitprompt
blob: 46367444c5436c7d3afc1fd8fda2c871522ea525 (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 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