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