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