-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbashrc
217 lines (175 loc) · 5.83 KB
/
bashrc
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
#!/bin/bash
# Mike Clarke .bashrc
# (inspired by Ryan Tomayko)
# <https://raw.github.com/rtomayko/dotfiles/rtomayko/.bashrc>
: ${HOME=~}
: ${LOGNAME=$(id -un)}
: ${UNAME=$(uname)}
: ${HOSTFILE=~/.ssh/known_hosts}
: ${INPUTRC=~/.inputrc}
# ----------------------------------------------------------------------
# SHELL OPTIONS
# ----------------------------------------------------------------------
# bring in system bashrc
test -r /etc/bashrc &&
. /etc/bashrc
# notify of bg job completion immediately
set -o notify
# shell opts. see bash(1) for details
shopt -s cdspell >/dev/null 2>&1
shopt -s extglob >/dev/null 2>&1
shopt -s histappend >/dev/null 2>&1
shopt -s hostcomplete >/dev/null 2>&1
shopt -s interactive_comments >/dev/null 2>&1
shopt -u mailwarn >/dev/null 2>&1
shopt -s no_empty_cmd_completion >/dev/null 2>&1
# fuck that you have new mail shit
unset MAILCHECK
# disable core dumps
ulimit -S -c 0
# default umask
umask 0022
# ----------------------------------------------------------------------
# PATH
# ----------------------------------------------------------------------
# we want the various sbins on the path along with /usr/local/bin
PATH="$PATH:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin"
PATH="/usr/local/bin:/usr/local/share/python:$PATH"
# put ~/bin on PATH if you have it
test -d "$HOME/bin" &&
PATH="$HOME/bin:$PATH"
# ----------------------------------------------------------------------
# ENVIRONMENT CONFIGURATION
# ----------------------------------------------------------------------
# detect interactive shell
case "$-" in
*i*) INTERACTIVE=yes ;;
*) unset INTERACTIVE ;;
esac
# detect login shell
case "$0" in
-*) LOGIN=yes ;;
*) unset LOGIN ;;
esac
# enable en_US locale w/ utf-8 encodings if not already configured
#: ${LANG:="en_US.UTF-8"}
#: ${LANGUAGE:="en"}
#: ${LC_CTYPE:="en_US.UTF-8"}
#: ${LC_ALL:="en_US.UTF-8"}
#export LANG LANGUAGE LC_CTYPE LC_ALL
# always use PASSIVE mode ftp
: ${FTP_PASSIVE:=1}
export FTP_PASSIVE
# ignore backups, CVS directories, python bytecode, vim swap files
FIGNORE="~:CVS:#:.pyc:.swp:.swa:apache-solr-*"
# history stuff
HISTCONTROL=ignoreboth
HISTFILESIZE=10000
HISTSIZE=10000
# ----------------------------------------------------------------------
# PAGER / EDITOR
# ----------------------------------------------------------------------
# See what we have to work with ...
HAVE_VIM=$(command -v vim)
# EDITOR
test -n "$HAVE_VIM" &&
EDITOR=vim ||
EDITOR=vi
export EDITOR
# PAGER
if test -n "$(command -v less)" ; then
PAGER="less -FirSwX"
MANPAGER="less -FiRswX"
else
PAGER=more
MANPAGER="$PAGER"
fi
export PAGER MANPAGER
# Ack
ACK_PAGER="$PAGER"
ACK_PAGER_COLOR="$PAGER"
# ----------------------------------------------------------------------
# PROMPT
# ----------------------------------------------------------------------
RED="\[\033[0;31m\]"
BROWN="\[\033[0;33m\]"
GREY="\[\033[0;97m\]"
BLUE="\[\033[0;34m\]"
CYAN="\033[1;36m";
PS_CLEAR="\[\033[0m\]"
SCREEN_ESC="\[\033k\033\134\]"
if [ "$PS1" ]; then
if [[ $UID -eq 0 ]]; then
PS1="\[$RED\] \u@\h:\[$BLUE\]\w\\[\033[0;39m\]\n# "
else
PS1="\[$CYAN\] \u@\h:\[$BLUE\]\w\\[\033[0;39m\]\$(__git_ps1)\n\$ "
fi
export PROMPT_COMMAND="echo -n \[\$(date +%H:%M:%S)\]"
#export PS1=" "$PS1"\[\e]30;\u@\h\a\]"
fi
# ----------------------------------------------------------------------
# ALIASES / FUNCTIONS
# ----------------------------------------------------------------------
alias grep='grep --color'
# ----------------------------------------------------------------------
# MACOS X / DARWIN SPECIFIC
# ----------------------------------------------------------------------
if [ "$UNAME" = Darwin ]; then
# put ports on the paths if /opt/local exists
alias vim="vim"
alias vi="vim"
alias lock="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
# setup java environment. puke.
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
ANT_HOME="/Developer/Java/Ant"
export ANT_HOME JAVA_HOME
fi
# ----------------------------------------------------------------------
# BASH COMPLETION
# ----------------------------------------------------------------------
test -z "$BASH_COMPLETION" && {
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
test -n "$PS1" && test $bmajor -gt 1 && {
# search for a bash_completion file to source
for f in /usr/local/etc/bash_completion \
/usr/pkg/etc/bash_completion \
/opt/local/etc/bash_completion \
/etc/bash_completion
do
test -f $f && {
. $f
break
}
done
}
unset bash bmajor bminor
}
source ~/.bash_completion
# ----------------------------------------------------------------------
# LS AND DIRCOLORS
# ----------------------------------------------------------------------
# we always pass these to ls(1)
LS_COMMON="-hBG"
# if the dircolors utility is available, set that up to
dircolors="$(type -P gdircolors dircolors | head -1)"
test -n "$dircolors" && {
COLORS=/etc/DIR_COLORS
test -e "/etc/DIR_COLORS.$TERM" && COLORS="/etc/DIR_COLORS.$TERM"
test -e "$HOME/.dircolors" && COLORS="$HOME/.dircolors"
test ! -e "$COLORS" && COLORS=
eval `$dircolors --sh $COLORS`
}
unset dircolors
# setup the main ls alias if we've established common args
test -n "$LS_COMMON" &&
alias ls="command ls $LS_COMMON"
# these use the ls aliases above
alias ll="ls -l"
alias l.="ls -d .*"
alias la='ls $LS_OPTIONS -alG'
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# vim: ts=4 sts=4 shiftwidth=4 expandtab
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"