### NEWS Configuration


setopt HIST_VERIFY
setopt NO_BEEP
setopt printeightbit

# host=`hostname | sed -e 's/\..*//'`
host=$HOST:fr
tty=$TTY:t
HISTFILE=$HOME/.history.$tty
HISTSIZE=200
SAVEHIST=$HISTSIZE

limit datasize unlimited
limit stacksize 60M


export dirfile="$HOME/.who.$host.$tty"
export dirhfile="$HOME/.who.$host"
if [[ ! -f $dirfile ]]; then
    if [[ ! -f $dirhfile ]]; then
	dir=$HOME
    else
	dir=`cat $dirhfile`
    fi
else
    dir=`cat $dirfile`
    if [[ -d $dir ]]; then
	cd $dir
    else
	dir=$HOME
    fi
fi

if [[ $TERM == "xterm" ]]; then
    export TERM=xterm-color
fi

echo $dir > $dirfile
# we need a lock
if [[ ! -f $dirhfile ]]; then
    echo $dir > $dirhfile
fi

DIRSTACKSIZE=6
setopt AUTO_PUSHD

function pushd {
    builtin pushd "$@"
    echo $PWD > $dirfile
    echo $PWD > $dirhfile
}

function popd {
    builtin popd "$@"
    echo $PWD > $dirfile
    echo $PWD > $dirhfile
}

function cd {
    builtin cd "$@"
    echo $PWD > $dirfile
    echo $PWD > $dirhfile
}

function phd {
    cat $dirhfile
}

function hd {
    cd `cat $dirhfile`
}

export MANPATH=$MANPATH:/usr/share/man:/usr/local/share/man:/usr/local/man:/usr/local/news/man

if [[ -f ~/bin/jless ]]; then
    alias   more=jless
else
    alias   more=less
fi


alias   h="fc -l -d -20"
alias   history="fc -l -d -$HISTSIZE" 
alias   j=jobs

alias   javac="javac -J-Dfile.encoding=UTF8"


alias sslogin='eval `ssh-agent`; ssh-add ~/.ssh/id_dsa'
alias sslogon='ssh-add ~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh/identity'

alias nslookup="nslookup -sil"
# alias irulan="ssh $irulan"
alias rless="unset LESSOPEN; less"

# alias trn="export LANG=C; trn"

prompt='%S+%s%m%S+%s%n ' 

mailpath=/var/mail

stty susp '^z'

setopt PUSHD_IGNORE_DUPS
alias pu=pushd
alias po=popd

function mytitle {
    echo -n ']2;'${host}': '${PWD}''
}

if [[ $TERM = [xk]term* ]]; then
function precmd {
    mytitle
}
fi

function whois {
    ldapsearch -LLL "(uid=$@)"
}

function sshow {
    printenv | grep SSH | sed -e 's/^/export /' 
}

if [[ -f /usr/local/bin/gnuls ]]; then
    alias   ls="gnuls --show-control-chars --color=auto -F"
elif [[ $OSTYPE = linux* ]]; then
    alias   ls="ls --show-control-chars --color=auto -F"
else
    alias   ls="ls -F -w"
fi

alias   re='rm #* *~ #.* .*~ *.dvi *.log *.blg *.bak *.swp;'

autoload -U compinit 
compinit 

