add words to ispell_default
[home-base.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 running interactively, then:
6 if [ "$PS1" ]; then
7
8     # don't put duplicate lines in the history. See bash(1) for more options
9     export HISTCONTROL=ignoredups
10     if [ -x ~/bin/sane_editor ]; then
11         EDITOR=~/bin/sane_editor;
12     elif [ -x /usr/bin/jed ]; then
13         EDITOR="/usr/bin/jed";
14     elif [ -x /usr/bin/vi ]; then
15         EDITOR="/usr/bin/vi";
16     fi;
17
18     if [ -n "$EDITOR" ]; then
19         export EDITOR;
20     fi;
21     # bts debian options
22
23     if [ -e bin/faf ]; then
24         complete -F _command faf
25     fi;
26
27     export DEBEMAIL="don@debian.org"
28     export DEBHOME="$(eval 'echo' '~/projects/debian')"
29
30     export GTK_IM_MODULE=xim
31     export QT_IM_MODULE=xim
32
33     # enable color support of ls and also add handy aliases
34     eval `dircolors -b`
35     alias ls='ls --color=auto'
36
37     # See if we're in a chroot
38     if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
39         debian_chroot=$(cat /etc/debian_chroot)
40     fi
41
42     # we want to set the color based on what machine we're on
43     # if it's a remote, SSH_CONNECTION will be set
44     # set variable identifying the chroot you work in (used in the prompt below)
45     
46     # disable terminal bell
47     bind 'set bell-style none'
48
49     if [ -n "$SSH_CONNECTION" -o -n "$SSH_CLIENT" ]; then
50         # figure out what color to use
51         COLOR=$(hostname|md5sum|perl -ne 'if (/^([a-f\d]{8})/) {
52               my $num = unpack(q(L),pack(q(H*),$1));
53               my @col = map {(qq(0;${_}m),qq(1;${_}m))} 31..37;
54               my $col = $col[$num % @col];
55               if ($col eq q(0;36m)) {
56                  $col = q(1;30m);
57               }
58               print $col;
59               }')
60         PS1="${debian_chroot:+($debian_chroot)}\[\033[$COLOR\]\h \[\033[0;36m\]\t \w$\[\033[0m\] "
61         unset COLOR
62     else
63         PS1="${debian_chroot:+($debian_chroot)}\[\033[0;36m\]\h \t \w$\[\033[0m\] "
64     fi;
65     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
66
67     # make sure the term we're using exists in the termcap
68     if [[ "$TERM" =~ "rxvt-" ]] && which tput >/dev/null 2>&1; then
69         if [[ -z "$(tput longname 2>/dev/null)" ]]; then
70             TERM="xterm-${TERM##rxvt-}"
71             export TERM
72         fi;
73     fi;
74     if [[ "$TERM" =~ "stterm-" ]] && which tput >/dev/null 2>&1; then
75         if [[ -z "$(tput longname 2>/dev/null)" ]]; then
76             TERM="xterm-${TERM##stterm-}"
77             export TERM
78         fi;
79     fi;
80     # If this is an xterm set the title to user@host:dir
81     case $TERM in
82         screen|xterm*|stterm*)
83             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
84             ;;
85         rxvt*)
86             PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007"'
87             ;;
88
89         *)
90             ;;
91     esac
92
93     # enable programmable completion features (you don't need to enable
94     # this, if it's already enabled in /etc/bash.bashrc).
95     if [ -f /etc/bash_completion ]; then
96       . /etc/bash_completion;
97     fi;
98
99     # set up ssh-agent
100     if which ssh-agent >/dev/null && [ -d ~/.ssh ] &&  \
101         [ -z "$SSH_CONNECTION" ] &&  [ -z "$SSH_CLIENT" ]; then 
102 #       for 
103         if [ -e ~/.ssh/ssh_agent_info ] && \
104             [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
105             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
106             . ~/.ssh/ssh_agent_info > /dev/null
107         elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
108             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
109             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
110         else
111             ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)
112             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
113         fi;
114     fi;
115     
116     alias aumix2='aumix -d /dev/mixer1 -I'
117     if locale -a |grep -qi en_US.utf8; then
118         LANG="en_US.UTF-8"
119     else
120         LANG=C
121     fi;
122     export LANG
123     
124     # If we're running on liszt, include /var/list/.bin in the path
125     if [ "$(hostname)" == "liszt" ] && [ -d /var/list/.bin ]; then
126         PATH="/var/list/.bin:$PATH"
127     fi;
128     export PATH="$(getent passwd $(id -u)|awk -F: '{print $6}')/bin:$PATH"
129     
130     if [ ! -e ~/tmp ]; then
131         mkdir ~/tmp;
132     fi;
133     export TMPDIR="$(echo ~/tmp)";
134
135         cd ()
136         {
137             # use pushd instead of cd
138             if [ -z "$1" ] || [ "$1" == "-" ]; then
139                 builtin cd "$@"; # && [ -r .todo ] && devtodo ${TODO_OPTIONS};
140             else
141                 builtin pushd "$@" >/dev/null; # && [ -r .todo ] && devtodo ${TODO_OPTIONS};
142             fi;
143         }
144
145 fi