#!/bin/bash
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bashrc,v 1.8 2003/02/28 15:45:35 azarah Exp $

# This file is sourced by all *interactive* bash shells on startup.  This
# file *should generate no output* or it will break the scp and rcp commands.

# colors for ls, etc.
#eval `dircolors -b /etc/DIR_COLORS`
export BROWSER="epiphany"
export TERMCMD="gnome-terminal"
export VISUAL="gvim -f"
export EDITOR="vim"

set bell-style none

export HISTFILESIZE=
export HISTSIZE=10000

export XDG_DATA_HOME=$HOME/.data/
export XDG_CONFIG_HOME=$HOME/.config/
export XDG_CACHE_HOME=$HOME/.cache/

export GIT_AUTHOR_NAME="Johan Segolsson"
export GIT_COMMITTER_NAME="phaero"
export GIT_AUTHOR_EMAIL="johan.segolsson@gmail.com"

export DEBFULLNAME="Johan Segolsson"
export DEBEMAIL="johan.segolsson@gmail.com"

#export MPD_HOST="jshome"
export MPD_HOST="localhost"

PATH=$PATH:$HOME/bin:$HOME/app/bin:$HOME/web/django_src/django/bin
export PATH

function prompt_command {
	tput sc
	let backwash=$(tput cols)-$(echo $(pwd) | wc -m)-2
	tput cup 0 $backwash
	tput setaf 4 ; tput bold
	echo -n "["
	tput setaf 6
	echo -n "$(pwd)"
	tput setaf 4 ; tput bold
	echo -n "]"
	tput rc
	# Change the window title of X terminals 
	case $TERM in
		xterm*|rxvt|Eterm|eterm)
			echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"
			;;
		screen)
			echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"
			;;
	esac
}
PROMPT_COMMAND=prompt_command

if ${use_color} ; then
	if [[ ${EUID} == 0 ]] ; then
		PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
	else
		PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
	fi
else
	if [[ ${EUID} == 0 ]] ; then
		# show root@ when we don't have colors
		PS1='\u@\h \W \$ '
	else
		PS1='\u@\h \w \$ '
	fi
fi

# Syntax highlighted man and opened in vim
function man
{
	/usr/bin/man $* | col -bp | iconv -c | view -c 'set ft=man nomod nolist' -
}

# source all my alias
source ~/.alias

# source cdargs
source /usr/share/doc/cdargs/examples/cdargs-bash.sh

eval "$(lessfile)"

# use vi key bindings in sh
set -o vi

##uncomment the following to activate bash-completion:
[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion
#source $HOME/.gentoo/java
#source $HOME/.gentoo/java-env-classpath

shopt -s histappend
PROMPT_COMMAND='history -a'

keychain ~/.ssh/id_dsa
. ~/.keychain/$HOSTNAME-sh
