#
# /etc/zshrc is sourced in interactive shells.  It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
umask 022

# Set up aliases, this may confuse gurus but well after all gurus now
# how to remove alias.
alias mv='nocorrect mv -i'       # no spelling correction on mv
alias cp='nocorrect cp -i'       # no spelling correction on cp
alias rm='nocorrect rm -i'       # no spelling correction on rm
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir

# Set prompts
PROMPT="%n@%m %3~ %(!.#.$) "    # default prompt

# Some environment variables
path=($path $HOME/bin)
export HISTFILE=${HOME}/.bash_history
export HISTSIZE=1000
export SAVEHIST=1000
export USER=$USERNAME
export HOSTNAME=$HOST

# bindkey -v             # vi key bindings
bindkey -e               # emacs key bindings

# Get keys working
bindkey "^[[2~" yank
bindkey "^[[3~" delete-char
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history

# Color completion.
export ZLS_COLORS=$LS_COLORS
zmodload -ui complist

# Completion functions
_compdir=/usr/share/zsh/$ZSH_VERSION/functions/Core
[[ -z $fpath[(r)$_compdir] ]] && fpath=($fpath $_compdir)
autoload -U compinit
compinit

for i in /etc/profile.d/*.sh
 do
   if [[ -x "$i" ]]; then
     source $i
   fi
 done

## General alias
#  alias -g L="|less"
#  alias -g H="|head"
#  alias -g T="|tail"
#  alias -g G="|grep"
#  alias -g N="&>/dev/null&"
#  alias -g O="2>&1"

## Bindkey you may think it's usefull 
#  bindkey ' ' magic-space  # also do history expansino on space
#  bindkey -s "^xs" '\C-e"\C-asu -c "'
#  bindkey -s "^xd" "$(date '+-%d_%b')"
#  bindkey -s "^xf" "$(date '+-%D'|sed 's|/||g')"
#  bindkey -s "^xp" "\$(pwd\)/"
#  bindkey -s "^xw" "\C-a \$(which \C-e\)\C-a"
