forked from 4moms/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_profile
134 lines (111 loc) · 3.29 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#Settings for all shells
#Environment variables
export EDITOR=vim
export VISUAL=$EDITOR
export PAGER=less
export CVS_RSH=ssh
export LESS="-RM"
export NODE_PATH=/usr/local/lib/node
export PATH=$HOME/bin:/usr/local/share/npm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
source /usr/local/opt/chruby/share/chruby/chruby.sh
# Settings for interactive shells
# return if not interactive
[[ $- != *i* ]] && return
# History settings
# ignoreboth=ignoredups:ignorespace
# ignoredups = ignore duplicate commands in history
# ignorespace = ignore commands that start with space
HISTCONTROL=ignoreboth
# Save (effectively) all commands ever
HISTSIZE=10000000
HISTFILESIZE=10000000
# only append the history at the end (shouldn't actually be needed - histappend)
shopt -s histappend
source /usr/local/opt/chruby/share/chruby/auto.sh
# Bash
alias ll='ls -lahG'
alias f='find . -name'
#Mac
alias tw='networksetup -setairportpower en0 off; networksetup -setairportpower en0 on;'
alias pg='ping google.com'
alias javac='javac *.java'
alias rmclass='rm *.class'
# Git
alias gg='git status'
alias gb='git branch -va'
alias gcm='git commit -m'
alias gf='git fetch'
alias gp='git push'
alias changes='git diff --numstat --shortstat start'
alias standup='git log --since yesterday --author `git config user.email` --pretty=short'
# Bundler
alias be='bundle exec'
alias bi='bundle install'
alias rake='be rake'
# Rspec
alias respect='bundle exec rspec'
# Rails
alias r='bundle exec rails s'
alias rspec='rspec -c'
# Pow
alias rpow='touch tmp/restart.txt'
# Apps
alias v='vim'
alias vi='vim'
function onport() {
(( $# )) || set -- 3000
lsof -Pni :$*
}
# Search history
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# Simulate Zsh's preexec hook (see: http://superuser.com/a/175802/73015 )
# (This performs the histappend at a better time)
simulate_preexec() {
[ -n "$COMP_LINE" ] || # skip if doing completion
[ "$BASH_COMMAND" = "$PROMPT_COMMAND" ] || # skip if generating prompt
history -a
}
trap simulate_preexec DEBUG
#command prompt customization
prompt() {
local WHITE="\[\033[1;37m\]"
local GREEN="\[\033[0;32m\]"
local CYAN="\[\033[0;36m\]"
local GRAY="\[\033[0;37m\]"
local BLUE="\[\033[0;34m\]"
local LIGHT_BLUE="\[\033[1;34m\]"
local YELLOW="\[\033[1;33m\]"
local RED="\[\033[1;31m\]"
local branch
if [ -d .git ] ; then
branch=$(git branch | awk '/^\*/ { print $2 }')
else
unset branch
fi
PS1="${YELLOW}\d \@ ${GREEN}\u@\h ${branch:+$LIGHT_BLUE$branch }${CYAN}\w${GRAY}
$ "
}
PROMPT_COMMAND=prompt
# retain $PROMPT_DIRTRIM directory components when the prompt is too long
PROMPT_DIRTRIM=3
if [[ -n "${BASH_SOURCE[0]}" ]] ; then
dotfiles="$(dirname "$(readlink "${BASH_SOURCE[0]}")")"
fi
# Finished if we couldn't find our root directory
[[ -z "$dotfiles" ]] && return
# Load completion files from $dotfiles/completion/{function}.bash
if (( BASH_VERSINFO[0] < 4 )) ; then
# For old versions of Bash, preload them all
for script in "$dotfiles/completion/"*.bash ; do
. "$script" > /dev/null 2>&1
done
else
# If we have version >= 4, we can load these as needed
_completion_load() {
. "$dotfiles/completion/$1.bash" > /dev/null 2>&1 && return 124
}
complete -D -F _completion_load
fi
# Workaround for broken chruby
chruby 2.0.0-p247