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