doo /.bash_profile

Shared History between concurrent shells and some other nice stuff
# .bashrc/.bash_profile for Adam Crews <doo@shroom.com>

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# add our local bin directory to the path
PATH=$PATH:$HOME/bin

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    COLORS=/etc/DIR_COLORS
    [ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM"
    [ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
    [ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
    [ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors"
    [ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM"
    [ -e $COLORS ] && eval "`dircolors -b`"
    alias ls='ls --color=auto'
    alias dir='ls --color=auto --format=vertical'
    alias vdir='ls --color=auto --format=long'
fi

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

# cleanup history a bit, make it so that we can share
# a common history between concurrent sessions
export HISTCONTROL=ignoreboth
export HISTSIZE=1000000 HISTFILESIZE=1000000
shopt -s histappend
if [ -n "$PROMPT_COMMAND" ]; then
    PROMPT_COMMAND="$PROMPT_COMMAND; history -a"
else
    PROMPT_COMMAND='history -a'
fi

function lsbytes {
    # inspired by http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x279.html
    # but I made it a single awk instead of an awk, forloop and a bc
    # asumes we have awk available.  but really, who doesnt have awk?
    # let's get the size of the files in this dir
    echo -n $(ls -l | awk '/^-/{total += $5} END{printf "%.2f", total/1048576}')
}

# a nice pretty color prompt
if [ "`id -u`" -eq 0 ]; then
    USER_COLOR='01;31'
else
    USER_COLOR='01;32'
fi

# set our nice pretty prompt
PS1='[${debian_chroot:+($debian_chroot)}\[\033[${USER_COLOR}m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] ($(lsbytes) Mb)]\$ '

# ugly hack... this is done so I can source my bashrc as another user, and get the same setup.
if [ -f ~acrews/.vimrc ]; then 
        alias vi='vim -u ~acrews/.vimrc'
        alias vim='vim -u ~acrews/.vimrc'
fi

# let's have a nice pager using vim as a replacement for less
function vimless {
    if test $# = 0; then
        vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' -
    else
        vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@"
    fi
}

alias less=vimless

export PATH
unset USERNAME

GPG_TTY=`tty`
export GPG_TTY

export EDITOR=vim

# vim: ts=4 sw=4 filetype=sh