Use dot operator instead of guillemotright for . slot 4 in _Xmodmap.
[dotfiles-framework.git] / _bashrc
1 # ~/.bashrc: executed by bash(1) for non-login shells.
2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3 # for examples
4
5 if [ -f /etc/bashrc ]; then
6     . /etc/bashrc
7 fi
8
9 # personalize path
10 export PATH=$HOME/bin:$HOME/script:$HOME/script/python:$HOME/script/lab:$HOME/lib/ruby/gems/1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
11 export LD_LIBRARY_PATH=~/lib
12
13 # personalize latex path
14 export TEXINPUTS=":.:$HOME/projects/latex/common/"
15
16 # personalize python path
17 PYTHON_VERSION=$(python -c 'import sys; print ".".join([str(i) for i in sys.version_info[:2]])')
18 export PYTHONPATH=".:$HOME/lib/python:$HOME/lib/python$PYTHON_VERSION/site-packages:$HOME/.python"
19
20 # append personal manpages to manpath
21 export MANPATH=":$HOME/share/man"
22
23 # personalize Java path (found by tracing from `which javac`)
24 export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
25
26 # personalize ruby and rubygems paths
27 # from http://docs.rubygems.org/read/chapter/15
28 PREFIX=$HOME
29 export GEM_HOME=$PREFIX/lib/ruby/gems/1.8
30 export RUBYLIB=$PREFIX/lib/ruby:$PREFIX/lib/site_ruby/1.8
31
32
33 # If not running interactively, don't do anything else
34 [ -z "$PS1" ] && return
35
36 # don't put duplicate line in the history and ignore lines starting
37 # with a space.  See bash(1).
38 export HISTCONTROL=ignoreboth
39
40 # check the window size after each command and, if necessary,
41 # update the values of LINES and COLUMNS.
42 shopt -s checkwinsize
43
44 # make less more friendly for non-text input files, see lesspipe(1)
45 [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
46
47 # set variable identifying the chroot you work in (used in the prompt below)
48 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
49     debian_chroot=$(cat /etc/debian_chroot)
50 fi
51
52 # adjust for Ubuntu not recognizing screen.* terms
53 if [ "${TERM:0:7}" == "screen." ]; then
54     export TERM="${TERM:7}"
55 fi
56
57 # set a fancy prompt (non-color, unless we know we "want" color)
58 case "$TERM" in
59     xterm-color) color_prompt=yes;;
60 esac
61
62 # uncomment for a colored prompt, if the terminal has the capability; turned
63 # off by default to not distract the user: the focus in a terminal window
64 # should be on the output of commands, not on the prompt
65 force_color_prompt=yes
66
67 if [ -n "$force_color_prompt" ]; then
68     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
69         # We have color support; assume it's compliant with Ecma-48
70         # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
71         # a case would tend to support setf rather than setaf.)
72         color_prompt=yes
73     else
74         color_prompt=
75     fi
76 fi
77
78 if [ "$color_prompt" = yes ]; then
79     # \[\033[XXm\] sets the color.  XX = 00:default, 31:red, 33:yellow
80     PS1='${debian_chroot:+($debian_chroot)}\[\033[31m\]\u@\h\[\033[00m\]:\[\033[33m\]\W\[\033[00m\]\$ '
81 else
82     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
83 fi
84 unset color_prompt force_color_prompt colorA colorB
85
86 # If this is an xterm set the title to user@host:dir
87 case "$TERM" in
88 xterm*|rxvt*)
89     PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
90     ;;
91 *)
92     ;;
93 esac
94
95 # Alias definitions.
96 # You may want to put all your additions into a separate file like
97 # ~/.bash_aliases, instead of adding them here directly.
98 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
99
100 #if [ -f ~/.bash_aliases ]; then
101 #    . ~/.bash_aliases
102 #fi
103
104 # Make file system utilities friendlier
105 alias rm='rm -iv'
106 alias rmdir='rmdir -v'
107 alias cp='cp -iv'
108 alias mv='mv -iv'
109 alias less='less -R'
110
111 # Configure useful programs
112 alias lp='/usr/bin/lp -o sides=two-sided-long-edge -o media=letter -o cpi=16 -o lpi=10'
113 alias lpb='/usr/bin/lp -o sides=two-sided-long-edge -o media=letter -o cpi=12 -o lpi=6'
114 alias lpi='/usr/bin/lp -o fitplot'
115 alias emacs='emacs -nw'
116 alias xterm='xterm -fg white -bg black'
117 alias w3mg='w3m http://www.google.com'
118 alias w3mh='w3m http://www.physics.drexel.edu/~wking/'
119 alias calendar='calendar -A28'
120 alias acroread='acroread -geometry 1270x950'
121 alias graph='graph -TX -C'
122 alias snownews='snownews -u'
123 alias oggr='ogg123 -qb 500' # play ogg radio streams (quiet, big input buffer)
124
125 # Alias useful one-liners & common commands
126 alias findex='find . -perm -u+x ! -type d'
127 alias sortdat='find . -printf "%TY-%Tm-%Td+%TH:%TM:%TS %h/%f\n" | sort -n'
128 alias sortdirdat='find . -type d -printf "%TY-%Tm-%Td+%TH:%TM:%TS %h/%f\n" | sort -n'
129 alias sshy='ssh wking@129.25.24.53'
130 alias ssha='ssh sysadmin@129.25.7.55'
131 alias sshxa='ssh -X sysadmin@129.25.7.55'
132
133 # enable color support of ls and also add handy aliases
134 if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
135     eval "`dircolors -b`"
136     alias ls='ls --color=auto'
137     #alias dir='ls --color=auto --format=vertical'
138     #alias vdir='ls --color=auto --format=long'
139
140     alias grep='grep --color=auto'
141     #alias fgrep='fgrep --color=auto'
142     #alias egrep='egrep --color=auto'
143 fi
144
145 # some more ls aliases
146 alias ll='ls -l'
147 alias la='ls -A'
148 alias l='ls -CF'
149
150 # enable programmable completion features (you don't need to enable
151 # this if it's already enabled in /etc/bash.bashrc and /etc/profile
152 # sources /etc/bash.bashrc).
153 if [ -f /etc/bash_completion ]; then
154     . /etc/bash_completion
155 fi
156
157 # define default programs
158 export EDITOR="/usr/bin/emacs -nw"
159 export PAGER="less"
160
161 # colorize file listings (di was 34 (blue), swapped with 33 (yellow))
162 export LS_COLORS='no=00:fi=00:di=00;33:ln=00;36:pi=40;34:so=00;35:bd=40;34;01:cd=40;34;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'
163
164 # turn off terminal beep in X
165 if [ $TERM == "xterm" ] && [ -n "$DISPLAY" ]
166     then
167     xset b off
168 fi
169
170 # turn of terminal beeps in the console, unless connecting via SSH
171 if [ -z "$SSH_CLIENT" ]; then
172     if [ ! -z "$TERM" ]; then
173         setterm -blength 0
174     fi
175 fi
176
177 ### ---- begin .dotfiles section ---- (keep this magic comment)
178
179 # Check for Git (versioning system) so we know how to get our .dotfiles
180 GIT_PATH=`which git`
181 if [ -n "$GIT_PATH" ];then
182    GIT_INSTALLED="true"
183 else
184    GIT_INSTALLED="false"
185 fi
186
187 # If we don't have checked out copies of our dotfiles, get them
188 if [ ! -d ~/.dotfiles/ ]; then
189     http="http://einstein.physics.drexel.edu/~wking/code/git/dotfiles.git"
190     ssh="http://einstein.physics.drexel.edu/~wking/code/git/dotfiles.git"
191     tgz="http://einstein.physics.drexel.edu/~wking/code/tar/dotfiles.tgz"
192     if [ $GIT_INSTALLED == "true" ]; then
193         git clone $http ~/.dotfiles
194         # setup to use ssh by default.
195         sed -i "s/$http/$ssh/" ~/.dotfiles/.git/config
196     else
197         # fallback on wgetting the tarball
198         pushd ~
199         wget --output-document dotfiles.tgz $tgz
200         tar -xzvf dotfiles.tgz
201         rm -rf dotfiles.tgz
202         popd
203     fi
204 fi
205
206 # If we have checked out copies of our dotfiles (i.e. clone successful)
207 if [ -d ~/.dotfiles/ ]; then
208     # Update once a week from our remote repository.
209     if [ ! -e ~/.dotfiles/updated.`date +%U` ]; then
210         rm -f ~/.dotfiles/updated.* 2>/dev/null
211         touch ~/.dotfiles/updated.`date +%U`
212         pushd ~/.dotfiles
213         make fixup
214         popd
215     fi
216 fi
217
218 ### ---- end .dotfiles section ---- (keep this magic comment)