-
Notifications
You must be signed in to change notification settings - Fork 2
/
bash_profile
73 lines (61 loc) · 1.99 KB
/
bash_profile
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
export BASH_SILENCE_DEPRECATION_WARNING=1
alias ls='ls -G --color=auto'
alias rm='rm -i'
alias ll='ls -alhF --color=auto'
alias tree='tree -C'
# Setting GIT prompt
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
c_blue=`tput setaf 4`
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_red}
else
color=${c_green}
fi
else
return 0
fi
echo -n $color
}
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
}
# Run on terminal starts
branch_color
parse_git_branch
cat ~/.welcome-terminal.txt
#It's important to escape colors with \[ to indicate the length is 0
PS1='${c_blue}\[(\t)\] ${c_green}\u@\[ \]\W\[\]\[\[$(branch_color)\] $(parse_git_branch)\[\]${c_sgr0}\n$ '
# Git completion for bash
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# ######################################## Ruby ########################################
if [[ -s $HOME/.rvm/scripts/rvm ]]; then
source $HOME/.rvm/scripts/rvm;
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# ######################################## NVM ########################################
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# ######################################## Java ########################################
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"