
function precmd {

# See if we can use colors.

# Must have the zsh/termcap module loaded for this
if [[ $terminfo[colors] -ge 8 ]]; then
    local RED="%{[1;31m%}"
    local LIGHT_RED="%{[0;31m%}"
    local CYAN="%{[1;36m%}"
    local LIGHT_CYAN="%{[0;36m%}"
    local BLUE="%{[1;34m%}"
    local LIGHT_BLUE="%{[0;34m%}"
    local GREEN="%{[1;32m%}"
    local LIGHT_GREEN="%{[0;32m%}"
    local MAGENTA="%{[1;35m%}"
    local LIGHT_MAGENTA="%{[0;35m%}"
    local YELLOW="%{[1;33m%}"
    local LIGHT_YELLOW="%{[0;33m%}"
    local GRAY="%{[1;30m%}"
    local LIGHT_GRAY="%{[0;37m%}"
    local WHITE="%{[1;37m%}"
    local NO_COLOUR="%{[0m%}"
    local BEGINNING_OF_LINE="%{[80D%}"
else
    local RED=""
    local LIGHT_RED=""
    local CYAN=""
    local LIGHT_CYAN=""
    local BLUE=""
    local LIGHT_BLUE=""
    local GREEN=""
    local LIGHT_GREEN=""
    local MAGENTA=""
    local LIGHT_MAGENTA=""
    local YELLOW=""
    local LIGHT_YELLOW=""
    local GRAY=""
    local LIGHT_GRAY=""
    local WHITE=""
    local NO_COLOUR=""
    local BEGINNING_OF_LINE=""
fi

###
# Decide whether to set a screen title
if [[ "$STY" != "" ]]; then
    local STITLE='%{kzsh\%}'
else
    local STITLE=''
fi

###
# Decide if we need to set titlebar text.
case $TERM in
    xterm*)
	local TITLEBAR='%{]0;%n@%m:%~%}'
	;;
    screen)
	local TITLEBAR='%{]0;screen  (t) %n@%m:%~%}'
	;;
    *)
	local TITLEBAR=""
	;;
esac

PROMPT="%n@%m%(!|%{$fg[yellow]%}|%{$fg_bold[black]%})%(?.>.%{$fg[red]%} [%?]>)%{$fg_no_bold[default]%} "
RPROMPT="$GRAY%~$NO_COLOUR"

}

preexec () {
    if [[ "$STY" != "" ]]; then
	local CMD=`echo $1 | sed 's/^sudo //; s/ .*//'`
	echo -n "k$CMD\\"
    fi
}

## Some stuff which does not work...
# FIXXME - does not work, try to remove all "not necessary tags"
#  leoorg () { T=~/.tmp/dict_leo_"$1".html; lynx -source "http://dict.leo.org/?search="$1"" > $T ; lynx "$T" }
#  vim `l\s -t * | head -1 ` }
#
# FIXXME - does not work :-(
#  alias en1='lynx -source "http://dictionaries.travlang.com/ItalianGerman/dict.cgi?query="$1""'
#\!^" '
#sed -n "//,/<\/pre>/p" | grep -v "pre>" ' 

################ END OF FILE ###################################################
