-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_profile
74 lines (58 loc) · 1.94 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
# Get the Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Custom bash prompt
# Includes custom character for the prompt, path, and Git branch name
# Source: kirsle.net/wizards/ps1.html
export PS1="\n\[$(tput bold)\]\[$(tput setaf 5)\]➜ \[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput sgr0)\]"
# Aliases
alias editbash='atom ~/.bash_profile'
alias editalias='atom ~/.bash_aliases'
alias resource='source ~/.bash_profile && echo "Done!"'
# More aliases
source ~/.bash_aliases
# Shortcuts
## `mkdir` and go to that dir
function hit() {
mkdir "$1" && cd "$1"
}
## `cd` and `ll`
function cs() {
cd "$1" && ll
}
## AnyBar
## https://github.com/tonsky/AnyBar
function anybar {
echo -n $1 | nc -4u -w0 localhost ${2:-1738};
}
# PATH
## Homebrew's sbin
export PATH="/usr/local/sbin:$PATH"
## nvm
# I used to install nvm using homebrew
# It may lead to slow startup and nvm is utterly unsupported on homebrew
# https://github.com/creationix/nvm/issues/860#issuecomment-157945343
# source $(brew --prefix nvm)/nvm.sh
# source /usr/local/opt/nvm/nvm.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
## JAVA_HOME
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
## Android
# export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH"
# export PATH="$HOME/Library/Android/ndk:$PATH"
## z script (https://github.com/rupa/z)
source /usr/local/bin/z.sh
## git-completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
## Personal bin
export PATH="$HOME/bin:$PATH"
## Composer
export PATH="$HOME/.composer/vendor/bin:$PATH"
## Load RVM into a shell session *as a function*
## Keep next line at the bottom of .bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"