HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.history
setopt APPEND_HISTORY
setopt EXTENDED_HISTORY
      
export LESS="-R"
alias ...='../..' 
alias ....='../../..' 
alias .....='../../../..' 
alias ......='../../../../..' 
alias .......='../../../../../..'
#zstyle ':completion:*' use-cache on 
#zstyle ':completion:*' cache-path ~/.zsh/cache
WHITE=`print -P "%{\e[0;00m%}"`
BLACK=`print -P "%{\e[0;30m%}"`
RED=`print -P "%{\e[0;31m%}"`
GREEN=`print -P "%{\e[0;32m%}"`
YELLOW=`print -P "%{\e[0;33m%}"`
BLUE=`print -P "%{\e[0;34m%}"`
PURPLE=`print -P "%{\e[0;35m%}"`
CYAN=`print -P "%{\e[0;36m%}"`
export WHITE BLACK RED GREEN YELLOW BLUE PURPLE CYAN
function precmd {
freierspeicher=`df -h . | /usr/bin/tail -n1 | tr -s " " " " | cut -d" " -f4`
INFO=" (${freierspeicher} free)"
export PS1="%{${YELLOW}%}[%(!.%{${RED}%}%n. %{${GREEN}%}%n)%{${YELLOW}%}@%{${CYAN}%}%m%{${YELLOW}%}]%{${WHITE}%} %{${GREEN}%}%~${INFO}%{${WHITE}%} %# " }
export RPS1="%{${BLUE}%}-=%{${GREEN}%}%D{%a %d.%m.%Y} %*%{${BLUE}%}=-%{${WHITE}%}"
export SPROMPT='%R ist nicht vorhanden, meinten sie vielleicht %r? '
export PS2="%{${CYAN}%}<--%_-->%{${WHITE}%} "

zmodload zsh/complist
zmodload zsh/computil

autoload compinit
compinit
setopt listpacked
#setopt  autocorrect
setopt  auto_cd
zstyle ':completion:*:*:cd:*' tag-order local-directories
zstyle ':completion:*:*:lp*:*' tag-order jobs
zstyle ':completion:*:*:(kill|wait):*' tag-order 'jobs processes'
zstyle ':completion:*:*:(kill|wait):*' group-order jobs
zstyle ':completion:*:*' users-hosts \
       foo@bar.com \
        baz@foobar.net
zstyle ':completion:*' use-compctl false
zstyle ':completion:*:match:*' original yes
zstyle ':completion:incremental:*' list yes
zstyle ':completion:incremental:*' prompt 'incremental (%c): %u%s%a  %l'
zstyle ':completion:*:oldlist:*' menu verbose
zstyle ':completion:predict:*' completer _complete
zstyle ':completion:predict:*' list always
zstyle ':completion:predict:*' cursor key
zstyle ':completion:predict:*' special-dirs yes
zstyle ':completion:*:default' menu select
zstyle ':completion:*:(correct|approximate):*' max-errors 2 numeric
zstyle ':completion:*:(correct|approximate)-*:*' original yes
zstyle ':completion:*:paths' expand prefix
zstyle ':completion:*:option(-*|s)' auto-description 'specify %d'
zstyle ':completion:*:processes' command ps --forest -u $EUID -o pid,cmd
zstyle ':completion:*' verbose yes
zstyle ':completion:*' prefix-needed yes
zstyle ':completion:*' prefix-hidden no
zstyle ':completion:*' last-prompt yes
zstyle ':completion:*' users foo baz root
zstyle ':completion:*:complete:*:(all-|)files' ignored-patterns \
	  '?*~' '?*.(o|log|aux|elc|reg|pro|md[dh]|mdh[is]|syms|epro)' '(|*/)CVS'
zstyle ':completion:*:complete:*:(local|path)-directories' ignored-patterns '(|*/)CVS'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:jobs' prefix-needed no
zstyle ':completion:*' ignore-parents pwd parent
zstyle ':completion:*:complete:*:(functions|parameters|association-keys)' ignored-patterns '_*'
zstyle ':completion:::::' completer _complete _match _ignored _correct _approximate _prefix
zstyle ':completion:*' matcher-list '' 'm:{a-z-}={A-Z_} r:|[-_./]=* r:|=*' 'm:{a-z-}={A-Z_} l:|=* r:|=*'
zstyle ':completion:*:*:diff:*:version' command =diff -v
zstyle ':completion:*:*:(p|gview|xdvi|kill|psnup):*' menu yes select
zstyle ':completion:*:*:(p|gview|xdvi|psnup):*' file-sort time
zstyle ':completion:*:default' list-prompt 'Line %l  Continue?                                                                       %b'
zstyle ':completion:*:default' select-prompt 'Match %m  Line %l  %p                                                                                  %b'
zstyle ':completion:*:(cp|mv|rm):*' ignore-line yes
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:*:*make:*:targets' command awk \''/^[a-zA-Z0-9][^\/\t=]+:/ {print $1}'\' \$file
zstyle ':completion:*history*' remove-all-dups yes
zstyle ':completion:*history*' stop yes
zstyle ':completion:*:default' list-colors 'tc=35' 'ma=41;37' 'st=43;36' 'di=31;1' 'ex=33;1' \
                                           'ln=32' '*CVS=35' '*rej=31;1' '*orig=35'
zstyle ':completion:*:processes' list-colors \
			        '=(#b)( #[0-9]#)[^[/0-9a-zA-Z]#(*)=34=37;1=30;1'
zstyle ':completion:*:parameters' list-colors '=_*=33' '=[^a-zA-Z]*=31'
zstyle ':completion:*:functions' list-colors '=_*=33' '=*-*=31'
zstyle ':completion:*:original' list-colors '=*=31;1'
zstyle ':completion:*:all-expansions' list-colors '=*=32'
zstyle ':completion:*:reserved-words' list-colors '=*=31'
zstyle ':completion:*:(jobs|directory-stack|indexes)' list-colors \
						    '=(#b)(*) -- (*)=35;1=31;1=33;1'
zstyle ':completion:*:(options|values)' list-colors \
				        '=(#b)(*)-- (*)=35;1=31;1=33;1' '=*=31;1'
zstyle ':completion:*::lp*:jobs' list-colors '=(#b)* [0-9] ##([^ 	]##) ##([^ 	]##) ##([^ 	]##) ##(*)=35=32=31;1=33;1=32'

SELECTMIN=5
ZLS_COLOURS='ma=7:di=0:ex=0:bd=0:cd=0:ln=0:so=0'
export LS_COLORS='di=0;36'


# Here are some quick calculators that output in integer
# hexadecimal, decimal, and binary.
zcalc ()  { print $(( ans = ${1:-ans} )) }
zcalch () { print $(( [#16] ans = ${1:-ans} )) }
zcalcd () { print $(( [#10] ans = ${1:-ans} )) }
zcalco () { print $(( [#8] ans = ${1:-ans} )) }
zcalcb () { print $(( [#2] ans = ${1:-ans} )) }

# this last one lets you calculate the ascii value of a single character
zcalcasc () { print $(( [#16] ans = ##${1:-ans} )) }

bindkey -e
bindkey -M menuselect '/' accept-and-infer-next-history \
			                      '^U' undo \
		          	              '^@' accept-and-menu-complete \
               		                      '^A' .beginning-of-line-hist \
					      '^E' .end-of-line-hist \
					      '^P' vi-forward-blank-word \
					      '^N' vi-backward-blank-word \
					      '\e<' beginning-of-history \
					      '\e>' end-of-history
bindkey '^[[3~' delete-char 
bindkey '^[[7~' beginning-of-line 
bindkey '^[[8~' end-of-line
bindkey '^[[5~' backward-word
bindkey '^[[6~' forward-word
bindkey '^[[2~' overwrite-mode
bindkey '^[1' undo
bindkey '^[2' redo
bindkey '^[b' beep
bindkey '^[c' transpose-words
bindkey '^[y' transpose-chars
bindkey '^[[a' up-history
bindkey '^[[b' down-history
bindkey '^[s' copy-prev-shell-word

# Keypad
# 0 . Enter
bindkey -s "^[Op" "0"
bindkey -s "^[Ol" "."
bindkey -s "^[OM" "^M"
# 1 2 3
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
# 4 5 6
bindkey -s "^[Ot" "4"
bindkey -s "^[Ou" "5"
bindkey -s "^[Ov" "6"
# 7 8 9
bindkey -s "^[Ow" "7"
bindkey -s "^[Ox" "8"
bindkey -s "^[Oy" "9"
# + -  * /
bindkey -s "^[Ok" "+"
bindkey -s "^[Om" "-"
bindkey -s "^[Oj" "*"
bindkey -s "^[Oo" "/"

zstyle ':completion:*' use-cache on 
zstyle ':completion:*' cache-path ~/.zsh/cache

autoload -U tetris
zle -N tetris
bindkey ^T tetris



alias ll='ls -lh --color=auto'
alias grep='grep --color=auto'
alias pgrep='ps aux|head -n 1;ps aux | grep -v grep | grep -i'
alias hgrep='history 1|grep '
alias upd='apt-get update;apt-get upgrade'


export LANGUAGE=C
export LANG=C
export LC_ALL=en_US.utf8
export EDITOR=vim
export PAGER=less

