-
Notifications
You must be signed in to change notification settings - Fork 1
/
bashrc
69 lines (56 loc) · 1.22 KB
/
bashrc
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
#
# ~/.bashrc
#
# get global definitions
if [ -f /etc/bashrc ]; then
source /etc/bashrc
fi
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
if [ -e "$HOME/.aliases" ]; then
source "$HOME/.aliases"
fi
if [ -e "$HOME/.cargo/bin" ]; then
export PATH=$HOME/.cargo/bin:$PATH
fi
if [[ $OSTYPE == 'msys' ]]; then
eval `ssh-agent`
ssh-add
return
fi
# Disable suspend on <C+s>
stty -ixon
export PATH=/usr/local/sbin:/usr/local/git/bin:$PATH
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
return 0
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
}
export PATH=$HOME/.npm/bin:$PATH
PS1='[\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]] \u@\[${c_red}\]\w\[${c_sgr0}\]: '
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting