forked from richo/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 5
/
profile
239 lines (222 loc) · 6.25 KB
/
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
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
[ $SHLVL -eq 1 -a -z "$TERM_PROGRAM" ] &&
[ -e ~/.init_home ] && . ~/.init_home
if ls $HOME | grep "^android-sdk" > /dev/null; then
for i in $HOME/android-sdk*; do
PATH=$i/tools:$PATH
done
fi
if [ "$SHLVL" -eq 1 ]; then
# Hell, do this once per tty login
## XXX Should my path come first? In all likelyhood I want it to take precedence
export MAIL=imaps://domino.psych0tik.net
export UPSTREAMMAIL=imaps://[email protected]
export DEBFULLNAME="Rich Healey"
export EMAIL="[email protected]"
export KEY=89E72415
export EXCUSES_FILE=$HOME/code/storage/excuses
export SLEEP_MUSIC="http://kissy.psych0tik.net:8000/psych0tik.ogg"
export SLEEP_TIMEOUT=3600
export WAKEUP_PATH="dragonforce..."
export PYTHONPATH=$HOME/code/python/lib
export PGUSER=$USER
export TAGS_LIFETIME=$((60*60*24))
export bsd_dircolors="ExFxCxDxCxEgEdAbAgAcAd"
export SVNVERSION_TIMEOUT=5
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
if [[ -n $SSH_CLIENT || -n $SSH_CONNECTION || -n $SSH_TTY ]]; then
export IN_SSH=yes
fi
if [ -f ${HOME}/.termcap ]; then
TERMCAP=$(< ${HOME}/.termcap)
export TERMCAP
fi
for i in enlightenment_start openbox-session; do
# ^ These must be in reverse order because the last assignment will persist
which $i > /dev/null && export RICHOWM=$i
done
for i in firefox iceweasel uzbl vimprobable2; do
# ^ These must be in reverse order because the last assignment will persist
which $i > /dev/null && export BROWSER=$i
done
for i in vim vi nano ed; do
# ^ unlike the above decs, stop when we succeed
if which $i > /dev/null; then
export EDITOR=$(which $i)
export VISUAL=$(which $i)
break
fi
done
case `uname -s` in
"FreeBSD")
export PLATFORM="FREEBSD"
export LSCOLORS=$bsd_dircolors
sHost=`hostname -s`
;;
"Linux")
export PLATFORM="LINUX"
sHost=`hostname -s`
;;
"OpenBSD")
export PLATFORM="OPENBSD"
export LSCOLORS=$bsd_dircolors
sHost=`hostname -s`
;;
"Darwin")
export PLATFORM="DARWIN"
export LSCOLORS=$bsd_dircolors
export WIN_E=yes
sHost=`hostname -s`
;;
"MINGW32_NT-6.1")
export PLATFORM="WIN32"
sHost=`hostname`
;;
"SunOS")
export PLATFORM="SOLARIS"
sHost=`hostname`
;;
"Haiku")
export PLATFORM="HAIKU"
sHost=`hostname`
;;
*)
export PLATFORM="UNKNOWN"
sHost=`hostname`
;;
esac
fi
export sHost
if [ "$PLATFORM" = "WIN32" ]; then
rTITLE="$(basename $SHELL)"
elif [ "$PLATFORM" = "HAIKU" ]; then
rTITLE="$(basename $SHELL) $(tty)"
else
mesg n
rTITLE="$(basename $SHELL) $(tty)"
fi
if [[ -n $IN_SSH ]]; then
rTITLE="${sHost}: $rTITLE"
fi
export rTITLE
export sTITLE="$(basename $SHELL)"
alias WATCHR='ruby watchr.rb | grep -Ei "FAIL|ERROR" | grep -v "fail: 0, error: 0"'
alias be="bundle exec"
alias ducks='du -cks * | sort -rn | head -11'
alias gg="git grep"
alias ivlc="vlc -I ncurses"
alias loneshell="setopt nosharehistory"
alias lstree="ls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
alias lynx="lynx -accept_all_cookies"
alias mysql="noglob command mysql"
alias ngrep="grep -n"
alias sdig="dig +short"
alias ssl="openssl s_client -connect"
alias remusic="music_watch -t & tmux a"
alias svn_add_empty="svn add --depth empty"
alias twat="noglob command twat"
alias xcl='xclip'
alias xcp='xclip -selection clipboard'
if which colorsvn > /dev/null 2>&1; then
alias svn="colorsvn"
fi
# This should really be in some work specific include?
# Debating the worthiness of a ` include .profile.$(hostname)`
function svnrecommit() {
svn commit -F $1 && rm $1
}
function grawk() {
grep $1 | awk "{print \$$2}"
}
# Stole this mofo from teh samurai
function wiki()
{
dig +short txt $(echo $@ | sed -e 's/ /_/g').wp.dg.cx
}
#</Stoled>
gh()
{
case $1 in
"-g")
shift
echo "git://github.com:${1}.git" ;;
"-s")
shift
echo "[email protected]:${1}.git" ;;
"-?"|"-h")
echo "gh [-s|-g] user/richo" ;;
*)
echo "https://github.com/${1}.git" ;;
esac
}
# Defaults
export sed_r=-r
# Platform specific hax
case $PLATFORM in
# TODO grep -n for all platforms
"FREEBSD")
alias ls='ls -G'
alias ctags=exctags
alias grep="grep --colour"
function vol() { mixer vol $1; }
;;
"LINUX")
alias ls='ls --color=auto'
alias grep="grep --colour" ;;
"OPENBSD")
if which colorls > /dev/null 2>&1; then
alias ls="/usr/local/bin/colorls -G"
fi
function vol() { mixerctl outputs.master=$1,$1; }
;;
"DARWIN")
alias ls='ls -G'
export sed_r=-E
[ -f "$HOME/.profile_darwin" ] &&
source $HOME/.profile_darwin
;;
esac
# Hack for screen -a << ??
if [ -z "$INSCREEN" -a -z "$IN_SSH" ]; then
ZSH_TIME=" %T"
else
ZSH_TIME=""
fi
case $TERM in
rxvt-unicode-256color)
export TERM="rxvt-256color";;
*256*)
export VIM256=true;;
esac
# Do we have clientserver support?
if [ "$EDITOR" = "vim" ] && vim --version | grep "+clientserver" > /dev/null 2>&1; then
# Active some alias which sets --servername to something recognisable
# Do a $DISPLAY && because wihtout X it doesn't work anyway
:
fi
if [ "$sHost" = "solitaire" ]; then
case $TERM in
"screen")
export VIM256=true
;;
"rxvt-256color")
export VIM256=true
;;
esac
fi
# RVM Hax.
for _rvm in "$HOME/.rvm/scripts/rvm" "/usr/local/rvm/scripts/rvm"; do
if [[ -s "$_rvm" ]]; then
# Do rvm initialisy stuff
export have_rvm=true
source "$_rvm"
function cdgems() {
cd "$GEM_HOME"
}
break
fi
done
[ -e ~/.profile.local ] &&
source ~/.profile.local
[ -e ~/.profile.$sHost ] &&
source ~/.profile.$sHost
PATH=$HOME/bin:$PATH