-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.bash_profile
More file actions
316 lines (252 loc) · 10.9 KB
/
.bash_profile
File metadata and controls
316 lines (252 loc) · 10.9 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
export PATH=/usr/local/bin:$HOME/bin:$PATH
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
source .nvm/nvm.sh
# -------------------------------------------------------------------------------
# Aliases
# -------------------------------------------------------------------------------
# ---------------- General Aliases ---------------
alias bp='v ~/.bash_profile'
alias sbp='source ~/.bash_profile'
alias hosts='sudo v /etc/hosts'
# Flush the DNS -- sometimes helpful after connecting to or disconnecting from VPN
alias flushdns="dscacheutil -flushcache"
# --------------- Tmux Aliases -------------------
alias ta='tmux a -t'
alias tn='tmux new -s'
alias tk='tmux kill-session -t'
alias tl='tmux ls'
# Create alias to 'todo.sh', and configure bash completion to work with this alias
if [ -f $HOME/devtools/config-files/todo.txt-cli/todo.sh ]; then
alias t="$HOME/devtools/config-files/todo.txt-cli/todo.sh -d ~/.todo.cfg"
fi
export TODOTXT_DEFAULT_ACTION=ls
alias todotxt='subl ~/Dropbox/todos/todo.txt'
alias todos='todotxt'
# ---------------- ---- SHA1 -----------------------
# (note: md5 is already available, but sha1 isn't on the path)
alias sha="/usr/bin/openssl sha1"
alias sha1="/usr/bin/openssl sha1"
# ---------------------- Git ---------------------
# (some of these require git aliases as well)
alias gb='git branch --color'
alias gba='git branch -a --color'
alias gd='git diff | v'
alias gi='grep -i'
alias gl='git l'
alias gst='git st'
# ----------------- command line -----------------
#correct the typos in the cd command automatically
shopt -s cdspell
# add a lot of (albeit redundant) aliases to allow easy navigation
alias ..="cd .."
alias cd..="cd .."
alias ...="cd ../.."
alias ..2="cd ../.."
alias cd..2="cd ../.."
alias ....="cd ../../.."
alias ..3="cd ../../.."
alias cd..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."
alias gi="grep -i"
alias l="ls -G"
alias ls="ls -G"
alias la="ls -laG"
alias lm="ls -laG | more"
alias lf="ls -FG"
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
alias h=history
alias hm="history | more"
# ----------------- file find ---------------------
alias ff="find . -type f -name "
# find ./ -cmin -1 <--- finds all files changed in the last minute
# -------------------- VIM / MacVim ---------------
alias v="vim -N"
# If vim crashes with SEGV fault, the temp files need to be removed...
alias vimclean="rm -rf $HOME/.vim/_temp/%Users%$USER%working%*"
alias devnotes="v ~/devtools/config-files/dev_notes.md"
# ----------------- Mac OS X apps -----------------
alias calc="open -a Calculator"
alias saf="open -a Safari"
alias marked="open -a Marked"
# ------------------- Projects --------------------
alias rp='cd ~/working/rails_projects'
alias np='cd ~/working/js_projects/node_projects'
alias rat='cd ~/working/js_projects/node_projects/rat'
alias r='rails'
alias g='grails'
# -------------------------------------------------------------------------------
# History
# -------------------------------------------------------------------------------
# Don't save repeated commands; don't save commands that start with a space
export HISTIGNORE="&:[ ]*"
# These 3 lines remove duplicates, limit the size, and automatically append when closing a session
export HISTCONTROL=erasedups
export HISTSIZE=10000
shopt -s histappend
# -------------------------------------------------------------------------------
# Bash completion for Git
# -------------------------------------------------------------------------------
# Note: this does not work when using the Git aliases below, but only when using
# the normal 'git co xyz' commands.
if [ -f $HOME/devtools/config-files/git-completion.bash ]; then
source $HOME/devtools/config-files/git-completion.bash
fi
# -------------------------------------------------------------------------------
# Bash completion for 'todo.sh'
# -------------------------------------------------------------------------------
if [ -f $HOME/devtools/config-files/todo.txt-cli/todo_completion ]; then
source $HOME/devtools/config-files/todo.txt-cli/todo_completion
complete -F _todo t
fi
# -------------------------------------------------------------------------------
# Bash completion for 'tmux'
# -------------------------------------------------------------------------------
if [ -f /usr/local/etc/bash_completion.d/tmux ]; then
source /usr/local/etc/bash_completion.d/tmux
fi
# -------------------------------------------------------------------------------
# Terminal Colors
# -------------------------------------------------------------------------------
# LSCOLOR uses 11 foreground:background pairs, representing:
# directory
# symbolic link
# socket
# pipe
# executable
# block special
# character special
# executable with setuid bit set
# executable with setgid bit set
# directory writable to others, with sticky bit
# directory writable to others, without sticky bit
# These characters are used in LSCOLORS to specify colors for each pair
# a black
# b red
# c green
# d brown
# e blue
# f magenta
# c cyan
# h light grey
# A block black, usually shows up as dark grey
# B bold red
# C bold green
# D bold brown, usually shows up as yellow
# E bold blue
# F bold magenta
# G bold cyan
# H bold light grey; looks like bright white
# x default foreground or background
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# -------------------------------------------------------------------------------
# Prompt
# -------------------------------------------------------------------------------
# Put full path in title bar (so prompt doesn't have to be so long)
# Note: This line must be typed using these instructions: http://www.macworld.com/article/50257/2006/04/bashprompt.html
# (Note: this isn't working, hence it is commented out -- leaving it for reference.)
#export PROMPT_COMMAND='echo -n "]1;$PWD"'
# Limit the length of the path shown in the prompt
function prompt_command {
# How many characters of the $PWD should be kept
local pwd_length=23
if [ $(echo -n $PWD | wc -c | tr -d " ") -gt $pwd_length ]
then newPWD="$(echo -n $PWD | sed -e "s/.*\(.\{$pwd_length\}\)/\1/")"
else newPWD="$(echo -n $PWD)"
fi
}
PROMPT_COMMAND=prompt_command
export PROMPT_COMMAND
# function provides git branch identification
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
# Available prompt colors - use these when setting 'PS1' (which sets the prompt)
BLUE="\[\033[0;34m\]"
BOLD_BLUE="\[\033[1;31m\]"
CYAN="\[\033[0;36m\]"
BOLD_CYAN="\[\033[1;36m\]"
RED="\[\033[0;31m\]"
BOLD_RED="\[\033[1;31m\]"
PURPLE="\[\033[0;35m\]"
BOLD_PURPLE="\[\033[1;35m\]"
YELLOW="\[\033[0;33m\]"
BOLD_YELLOW="\[\033[1;33m\]"
LTGRAY="\[\033[0;37m\]"
DARKGRAY="\[\033[1;30m\]"
WHITE="\[\033[1;37m\]"
BLACK="\[\033[0;30m\]"
GREEN="\[\033[0;32m\]"
ORIGINAL="\[\033[0m\]"
DEFAULT="\[\033[0;39m\]"
LPS1="$CYAN\$(date +%H:%M) \${newPWD} $BOLD_YELLOW\$(parse_git_branch)$DEFAULT\$ "
SPS1="$BOLD_YELLOW\$(parse_git_branch)$DEFAULT\$ "
TPS1="\`if [ \$? = 0 ]; then echo -e '$GREEN\xE2\x98\xBA'; else echo -e '$RED\xE2\x98\xB9'; fi\` \[\e[01;34m\]\[\e[00m\]"
PS1="$LPS1"
# Short prompt just shows the git branch
alias sp="export PS1=\$SPS1"
alias spro="export PS1=\$SPS1"
alias sprompt="export PS1=\$SPS1"
alias shortprompt="export PS1=\$SPS1"
# Tiny prompt is just a green or red smiley face
alias tpro="export PS1=\$TPS1"
alias tprompt="export PS1=\$TPS1"
alias tinyprompt="export PS1=\$TPS1"
# Long prompt shows time, path, and git branch
alias lpro="export PS1=\$LPS1"
alias lprompt="export PS1=\$LPS1"
alias longprompt="export PS1=\$LPS1"
# -------------------------------------------------------------------------------
# NVM (manage Node.js versions)
# -------------------------------------------------------------------------------
if [ -f $HOME/.nvm/nvm.sh ]; then
source $HOME/.nvm/nvm.sh
[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion
fi
# -------------------------------------------------------------------------------
# MongoDB
# -------------------------------------------------------------------------------
alias mongostart='mongod run --config /usr/local/Cellar/mongodb/2.0.0-x86_64/mongod.conf'
# -------------------------------------------------------------------------------
# Oracle Sqlplus
# -------------------------------------------------------------------------------
# ORACLE SQL PLUS ENV VARIABLES
if [ -d /opt/oracle/instantclient ]; then
export ORACLE_HOME=/opt/oracle/instantclient
export NLS_LANG="AMERICAN_AMERICA.UTF8"
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export TWO_TASK=oracledb:1521/BAN83
fi
# -------------------------------------------------------------------------------
# Rails
# -------------------------------------------------------------------------------
# RVM -- use rvm help to see list of commands. Used to switch among ruby versions and gem sets
#if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
#[[ -r $rvm_path/scripts/completion ]] && source $rvm_path/scripts/completion
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# -------------------------------------------------------------------------------
# Java
# -------------------------------------------------------------------------------
if [ -d /opt/oracle/instantclient ]; then
# hack -- identifying work computer (because it has oracle)
export JAVA_OPTS="-XX:MaxPermSize=512m -XX:PermSize=128m -Xms1024m -Xmx3096m -Dhttp.proxyPort=8080 -Dhttp.proxyHost=www-proxy.sct.com -Dhttp.proxyHost=www-proxy.sct.com -Dhttp.proxyPort=8080 -DPROXY_SERVER_NAME=http://m039220:8081/nexus/content/groups/public"
else
export JAVA_OPTS="-XX:MaxPermSize=512m -XX:PermSize=128m -Xms1024m -Xmx3096m"
fi
# -------------------------------------------------------------------------------
# Scala / SBT
# -------------------------------------------------------------------------------
export SBT_OPTS="-XX:MaxPermSize=512m"
# -------------------------------------------------------------------------------
# Grails
# -------------------------------------------------------------------------------
#THIS MUST BE AT THE END OF THE FILE FOR GVM TO WORK!!!
if [ -f $HOME/.gvm/bin/gvm-init.sh ]; then
[[ -s "$HOME/.gvm/bin/gvm-init.sh" && -z $(which gvm-init.sh | grep '/gvm-init.sh') ]] && source "$HOME/.gvm/bin/gvm-init.sh"
fi
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/Users/chardt/.sdkman"
[[ -s "/Users/chardt/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/chardt/.sdkman/bin/sdkman-init.sh"