-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_env
73 lines (67 loc) · 1.21 KB
/
bash_env
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
gitver="no-branch"
fi
echo -e $gitver
}
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
color=""
if git diff --quiet 2>/dev/null >&2
then
color="${c_green}"
else
color=${c_red}
fi
else
return 0
fi
echo -ne $color
}
rvm_info ()
{
if [ -f ~/.rvm/bin/rvm-prompt ]
then
p=$(~/.rvm/bin/rvm-prompt v g s)
echo -ne "[ ${p} ] "
elif [ -f /usr/local/rvm/bin/rvm-prompt ]
then
p=$(/usr/local/rvm/bin/rvm-prompt v g s)
echo -ne "[ ${p} ] "
else
return 0
fi
}
git_info ()
{
git_loc=$(which git)
if [ ${git_loc:-''} != '' ]
then
if [ $(parse_git_branch) != "no-branch" ]
then
echo -ne "[ $(branch_color)$(parse_git_branch)${c_sgr0} ] "
else
return 0
fi
else
return 0
fi
}
if [ ${CUSTOM_PROMPT:-"YES"} == "YES" ]
then
PS1="\n-- \h:\W \$(git_info)\$(rvm_info)-- \n>> "
fi
export CLICOLOR=1
export LSCOLORS="cxgxcxdxbxegedabagacad"
export EDIT='vi'
export EDITOR='vi'