ijanos /.zshrc

#------------------
# autocomp
#------------------
autoload -Uz compinit
compinit
zstyle :compinstall filename '/home/ijanos/.zshrc'

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

#Fuzzy matching of completions for when you mistype them:
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 2 numeric
#setopt correctall

#proper killall completion
zstyle ':completion:*:killall:*' command 'ps -u $USER -o cmd'
#Completion with colors
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

## With commands like `rm' it's annoying if one gets offered the same filename
## again even if it is already on the command line. To avoid that:
zstyle ':completion:*:rm:*' ignore-line yes

#------------------
# misc
#------------------

# set xterminals' title bar
chpwd() {
  [[ -t 1 ]] || return
  case $TERM in
    sun-cmd) print -Pn "\e]l%~\e\\"
      ;;
    *xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;% [zsh] %~ [%n@%m]\a"
      ;;
  esac
}

#Avoid globbing on special commands
for com in alias expr find mattrib mcopy mdir wget mdel which;
alias $com="noglob $com"

# Turns off C-S/C-Q flow control
setopt no_flow_control

#History
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt HIST_IGNORE_SPACE
setopt HIST_IGNORE_ALL_DUPS

export PAGER='less'            # set pager
export EDITOR=vim              # set EDTIOR
export OOO_FORCE_DESKTOP=gnome # nice OO.o widgets
setopt nocheckjobs             # don't warn me about bg processes when exiting
setopt nohup                   # and don't kill them, either
setopt listtypes               # show types in completion

#------------------
# Colors
#------------------
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
autoload colors zsh/terminfo
eval `dircolors -b`

bindkey -e

#screen
setopt extended_glob
preexec () {
    if [[ "$TERM" == "screen" ]]; then
		local CMD=${1[(wr)^(*=*|sudo|-*)]}
		echo -ne "\ek$CMD\e\\"
    fi
}

#------------------
# Prompt
#------------------
setopt prompt_subst

if [[ "$TERM" == "screen" ]]; then
	PR_STITLE=$'%{\ekzsh\e\\%}'
fi

if [[ "$terminfo[colors]" -ge 8 ]]; then
	colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
      #eval PR_$color='%{$terminfo[]$fg[${(L)color}]%}'
      eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
      #eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
      eval PR_LIGHT_$color='%{$terminfo[]$fg[${(L)color}]%}'
      (( count = $count + 1 ))
done
PR_NO_COLOUR="%{$terminfo[sgr0]%}"

PROMPT='$PR_STITLE $PR_BLUE($PR_LIGHT_GREEN%~$PR_BLUE) %(!.$PR_RED.$PR_LIGHT_WHITE)%#$PR_NO_COLOUR '

#------------------
# key bindings
#------------------
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "^H" backward-delete-word
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# for freebsd console
#bindkey "\e[H" beginning-of-line
#bindkey "\e[F" end-of-line
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix

#------------------
# alias stuff
#------------------
alias ls='ls --color=auto -X'
alias ll='ls -lhX'
alias ..='cd ..'
alias ...="cd ../.."
alias ....="cd ../../.."
alias akksii='cat /proc/acpi/battery/BAT1/info'
alias akksi='cat /proc/acpi/battery/BAT1/state'
alias df='df -Th -x tmpfs -x fuse -x usbfs'
alias ds='du -sh'
alias png='ping bix.hu'
alias petofi='mplayer http://212.92.28.75:2404/'
alias tt='ls -Slrh|tail'
alias dtt='du -s *|sort -n|tail'
alias hdtt='du -s .*|sort -n|tail'
alias mv='mv -v -i'
alias cp='cp -v -i'
alias rm='rm -i'
alias pysize='pysize --ui=curses'
alias F='find . -iname'
alias X='startx'
alias topfiles='ls -lsR | sort -nr|less'
alias maemoX='Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -extension Composite &'