]> git.donarmstrong.com Git - home-base.git/blob - .bashrc
* Just use gimp-remote
[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     export DEBEMAIL="don@debian.org"
24
25     # enable color support of ls and also add handy aliases
26     eval `dircolors -b`
27     alias ls='ls --color=auto'
28     alias gr='gimp-remote'
29     alias emc='sane_editor'
30
31     alias svn-b="svn-buildpackage --svn-builder 'pdebuild --buildresult ..' --svn-ignore-new"
32
33     # set a fancy prompt
34     #printf '\33]2;%s\007'
35     # we want to set the color based on what machine we're on
36     # if it's a remote, SSH_CONNECTION will be set
37     if [ -n "$SSH_CONNECTION" ]; then
38         # figure out what color to use
39         COLOR=$(hostname|md5sum|perl -ne 'if (/^([a-f\d]{8})/) {
40               my $num = unpack(q(L),pack(q(h*),$1));
41               my @col = map {(qq(0;${_}m),qq(1;${_}m))} 31..37;
42               my $col = $col[$num%$#col];
43               if ($col eq q(0;36m)) {
44                  $col = q(1;30m);
45               }
46               print $col;
47               }')
48         PS1="\[\033[$COLOR\]\h \[\033[0;36m\]\t \w$\[\033[0m\] "
49         unset COLOR
50     else
51         PS1="\[\033[0;36m\]\h \t \w$\[\033[0m\] "
52     fi;
53     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
54
55     # make sure the term we're using exists in the termcap
56     TOEOPT='-a'
57     if ! toe $TOEOPT >/dev/null 2>&1; then
58         TOEOPT=''
59     fi;
60     if ! toe $TOEOPT|grep -q "^$TERM    "; then
61         # if it doesn't, try to switch
62         case $TERM in
63             rxvt*)
64                 TERM="rxvt"
65                 ;;
66             xterm*)
67                 TERM="xterm"
68                 ;;
69             *)
70                 ;;
71         esac
72         export TERM;
73     fi;
74     # If this is an xterm set the title to user@host:dir
75     case $TERM in
76         screen|xterm*)
77             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
78             ;;
79         rxvt*)
80             PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007"'
81             ;;
82
83         *)
84             ;;
85     esac
86
87     # enable programmable completion features (you don't need to enable
88     # this, if it's already enabled in /etc/bash.bashrc).
89     if [ -f /etc/bash_completion ]; then
90       . /etc/bash_completion;
91     fi;
92
93     # set up ssh-agent
94     if which ssh-agent >/dev/null && [ -d ~/.ssh ]; then
95 #       for 
96         if [ -e ~/.ssh/ssh_agent_info ] && \
97             [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
98             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
99             . ~/.ssh/ssh_agent_info > /dev/null
100         elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
101             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
102             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
103         else
104             ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)
105             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
106         fi;
107     fi;
108     
109     alias aumix2='aumix -d /dev/mixer1 -I'
110     if locale -a |grep -qi en_US.utf8; then
111         LANG="en_US.UTF-8"
112     else
113         LANG=C
114     fi;
115     export LANG
116     export PATH="~/bin:$PATH"
117     if [ ! -e ~/tmp ]; then
118         mkdir ~/tmp;
119     fi;
120     export TMPDIR="$(echo ~/tmp)";
121
122     if [ -n "$(which devtodo)" ]; then
123         for a in tda tdd tde; do
124             alias "s${a}"="STODO_NO_COMMIT=1 $a"
125         done;
126
127         TODO_OPTIONS="--timeout --summary"
128
129         cd ()
130         {
131             builtin cd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
132         }
133
134         pushd ()
135         {
136             builtin pushd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
137         }
138         
139         popd ()
140         {
141             builtin popd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
142         }              
143         
144         # Run todo initially upon login
145         devtodo ${TODO_OPTIONS}
146     fi;
147 fi