-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_profile
87 lines (68 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# path for homebrew
export PATH=/usr/local/bin:$PATH
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Make Sublime my default editor
export EDITOR='subl -w'
# Aliases
alias ls='ls -lap'
## PROMPT BUSINESS ##
# Let's sprinkle a little RVM and Git in there
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\033[1;33m\]'
c_path='\[\e[0;33m\]'
c_git_clean='\[\e[0;36m\]'
c_git_dirty='\[\e[0;35m\]'
else
c_reset=
c_user=
c_path=
c_git_clean=
c_git_dirty=
fi
# Function to assemble the Git part of our prompt.
git_prompt () {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
if git diff --quiet 2>/dev/null >&2; then
git_color="$c_git_clean"
else
git_color="$c_git_dirty"
fi
echo " [$git_color$git_branch${c_reset}]"
}
function rvm_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
[ "$version" != "" ] && version=" $version"
local full="$version$gemset"
[ "$full" != "" ] && echo "$full "
}
# Thy holy prompt.
PROMPT_COMMAND='PS1="${c_path}\w${c_reset}$(git_prompt) $(rvm_version)\$ "'
## END PROMPT BUSINESS ##
# Autocomplete for Git
# run 'curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash' to get the bash
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
function openbb() {
origin=`env -i git ls-remote --get-url origin`
url=${origin//'ssh://'}
url=${url/'git@'/'https://'}
url=${url/'.org:'/'.org/'}
url=${url/'.git'/'/pull-request/new'}
open $url
}