-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
272 lines (228 loc) · 7.79 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
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
#!/bin/bash
#
# /etc/profile
#
# This file is intended to be used for ALL common
# Bourne-compatible shells. Shell specifics should be
# handled in /etc/profile.$SHELL where $SHELL is the name
# of the binary being run (discounting symlinks)
#
# Sections taken from SuSe's /etc/profile
# Note the explicit use of 'test' to cover all bases
# and potentially incompatible shells
export PACKAGER="Nycholas de Oliveira e Oliveira <nycholas@gmail.com>"
#Determine our shell without using $SHELL, which may lie
shell="sh"
if test -f /proc/mounts; then
case $(/bin/ls -l /proc/$$/exe) in
*bash) shell=bash ;;
*dash) shell=dash ;;
*ash) shell=ash ;;
*ksh) shell=ksh ;;
*zsh) shell=zsh ;;
esac
fi
# Alias
alias l="ls -hF --color=always"
alias ls='ls -hF --color=always'
alias lr='ls -R' # recursive ls
alias lx='ll -BX' # sort by extension
alias lz='ll -rS' # sort by size
alias lt='ll -rt' # sort by date
alias lm='la | more'
alias ls="ls --color"
alias ll="ls -lh --color"
alias la="ls -a --color"
alias lla="ls -lha --color"
alias lll="ls -lhatr --color"
alias ..="cd .."
alias pacman32="pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf"
alias android32="schroot -p -- android"
alias mvn32="schroot -p -- mvn"
# modified commands
alias diff='colordiff' # requires colordiff package
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias more='less'
alias df='df -h'
alias du='du -c -h'
alias mkdir='mkdir -p'
alias nano='nano -w'
alias ping='ping -c 5'
alias ..='cd ..'
alias sudo='sudo -E'
# SVN
alias svnrm='svn st | grep ! | sed s/\!//g | xargs svn rm'
alias svnadd='svn st | grep ? | sed s/\?//g | xargs svn add'
# new commands
alias da='date "+%A, %B %d, %Y [%T]"'
alias du1='du --max-depth=1'
alias hist='history | grep $1' # requires an argument
alias openports='netstat --all --numeric --programs --inet'
alias pg='ps -Af | grep $1' # requires an argument (note: /usr/bin/pg is installed by the util-linux package; maybe a different alias name should be used)
# privileged access
if [ $UID -ne 0 ]; then
alias sudo='sudo -E'
alias scat='sudo cat'
alias svim='sudo vim'
alias root='sudo su'
alias reboot='sudo reboot'
alias halt='sudo halt'
alias update='sudo pacman -Su'
alias netcfg='sudo netcfg2'
fi
# Define some colors to use in the prompt
NO_COLOR="\[\033[0m\]"
LIGHT_WHITE="\[\033[1;37m\]"
WHITE="\[\033[0;37m\]"
GRAY="\[\033[1;30m\]"
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
LIGHT_RED="\[\033[1;31m\]"
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
YELLOW="\[\033[0;33m\]"
LIGHT_YELLOW="\[\033[1;33m\]"
BLUE="\[\033[0;34m\]"
LIGHT_BLUE="\[\033[1;34m\]"
MAGENTA="\[\033[0;35m\]"
LIGHT_MAGENTA="\[\033[1;35m\]"
CYAN="\[\033[0;36m\]"
LIGHT_CYAN="\[\033[1;36m\]"
# Colored output from ls is nice, but the default color choices need
# work for use on a dark/partially transparent background. Directories
# stay blue but get bold, and symbolic links get bold cyan instead of
# magenta.
export CLICOLOR=1
export LSCOLORS="ExGxcxdxbxegedabagacad"
export GREP_COLOR="1;33"
alias grep='grep --color=auto'
export LESS="-R"
# Load shell specific profile settings
test -f "/etc/profile.$shell" && . "/etc/profile.$shell"
# http://stackoverflow.com/questions/791765/unable-to-forward-search-bash-history-similarly-as-with-ctrl-r
stty -ixon
# Set our umask
umask 022
# Editor
export EDITOR=nano
# Python
export PYTHONSTARTUP=~/.pythonrc
# SVN
export SVN_EDITOR="/usr/bin/kdiff3"
# GUI
export GTK_IM_MODULE=xim
export MOZ_DISABLE_PANGO=1
export SAL_GTK_USE_PIXMAPPAINT=1
#export INTEL_BATCH=1 awesome3dStuff
export XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
export SAL_GTK_USE_PIXMAPPAINT=1
# Go lang
export GOROOT="/home/nycholas/src/golang"
export GOARCH="386"
export GOOS="linux"
export GOBIN="/home/nycholas/app/golang/"
# Java
#export ANT_HOME="/home/nycholas/app/apache-ant"
#export MAVEN_HOME="/home/nycholas/app/apache-maven"
#export MVN_HOME="$MAVEN_HOME"
export JAVA_HOME="/opt/java"
export JRE_HOME="/opt/java/jre"
export CATALINA_HOME="/home/nycholas/app/apache-tomcat"
export SHINDIG_HOME="/home/nycholas/app/apache-shindig"
export JBOSS_HOME="/home/nycholas/app/jboss-as"
export JBOSSTA_HOME="/home/nycholas/app/jbossta"
export GLASSFISH_HOME="/home/nycholas/app/glassfish"
export GRAILS_HOME="/home/nycholas/app/grails"
export ANDROID_HOME="/opt/android-sdk"
export ANDROID_SDK_ROOT="/opt/android-sdk"
export GDK_NATIVE_WINDOWS=1
export AWT_TOOLKIT=MToolkit
export GDK_USE_XFT=1
export QT_XFT=true
# Ogre 3d
export OGRE_SRC="/usr/local/src/_ogre"
export OGRE_HOME="/usr/local/src/_ogre"
# CrystalSpace
export CRYSTAL="/usr/share/crystalspace-1.4"
export CEL="/opt/celstart-1.2.1-linux-x86"
# Set our default path
PATH="$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:$MVN_HOME/bin:$JAVA_HOME/bin:$CATALINA_HOME/bin:/home/nycholas/app/eclipse:$JBOSS_HOME/bin:$ANT_HOME/bin:/home/nycholas/app/android-sdk-linux_x86-1.0_r1/tools:$GLASSFISH_HOME/bin:/usr/local/src/jam:$CEL:/opt/kde/bin:/home/nycholas/bin:$GRAILS_HOME/bin:/home/nycholas/app/golang:/usr/lib64/panda3d:/opt/google-appengine:/usr/local/vrpn/bin:/usr/local/panda/bin:/opt/java/bin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools"
export PATH
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/share/pkgconfig"
# Some readline stuff that is fairly common
HISTSIZE=1000
HISTCONTROL="erasedups"
INPUTRC="/etc/inputrc"
LESS="-R"
LC_COLLATE="C"
export HISTSIZE HISTCONTROL INPUTRC LESS LC_COLLATE
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -x $profile && . $profile
done
unset profile
fi
# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP
# Man is much better than us at figuring this out
unset MANPATH
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# begin blinking
export LESS_TERMCAP_mb=$'\E[01;31m'
# begin bold
export LESS_TERMCAP_md=$'\E[01;33m'
# end mode
export LESS_TERMCAP_me=$'\E[0m'
# begin standout-mode - info box
export LESS_TERMCAP_so=$'\E[01;41;37m'
# end standout-mode
export LESS_TERMCAP_se=$'\E[0m'
# begin underline
export LESS_TERMCAP_us=$'\E[01;32m'
# end underline
export LESS_TERMCAP_ue=$'\E[0m'
_compssh ()
{
cur=${COMP_WORDS[COMP_CWORD]};
COMPREPLY=($(compgen -W '$(cat ${HOME}/.ssh/config | grep "^Host\b" - | sed -e "s/Host //")' -- $cur))
}
complete -F _compssh ssh
# Change the prompt character dpeending on if we're in a repository
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo '☿' && return
echo '$'
}
## display the current git branch
__git_ps1() {
local b="$(git symbolic-ref HEAD 2>/dev/null)"
if [ -n "$b" ]; then
printf " (git:%s)" "${b##refs/heads/}"
fi
}
## display the current mercurial branch
__hg_ps1() {
local branch="$(hg branch 2> /dev/null)"
if [ -n "$branch" ]; then
printf " (hg:%s)" "${branch}"
fi
}
## display the current subversion revision
__svn_ps1() {
if [[ -d ".svn" ]]; then
printf " (svn:%s)" `svnversion`
fi
}
## My super cool prompt
export MY_PROMPT="\[\e]0;\u@\h: \w\a\]"
export MY_PROMPT="$MY_PROMPT${WHITE}[\t] ${LIGHT_GREEN}\u ${LIGHT_WHITE}@ ${LIGHT_RED}\h ${LIGHT_WHITE}in ${LIGHT_CYAN}\w${WHITE}\$(__git_ps1)\$(__hg_ps1)\$(__svn_ps1)\n${LIGHT_WHITE}\$(prompt_char)${NO_COLOR} "
## Basic prompt for everyone else
export BASIC_PROMPT="${WHITE}[\t] ${LIGHT_GREEN}\u@\h${LIGHT_WHITE}:${LIGHT_BLUE}\w${WHITE}\$${NO_COLOR} "
#export PS1=$MY_PROMPT
alias basic_prompt="export PS1=\$BASIC_PROMPT"
alias my_prompt="export PS1=\$MY_PROMPT"