pseup /.zshrc

# ------------------------------
# Options {{{

autoload -U compinit
compinit

# History
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=1000

# Prompt
#precmd() for first line, stops the awful reprint on resize
#precmd() { print -P "\e[0;32m[%n]\e[0;34m[%~]" }
#PS1="$(print '%{\e[0;32m%}> %{\e[0m%}')"
PS1="$(print '%{\e[0;32m%}[%n]%{\e[0;34m%}[%~]%{\e[0;32m%}: %{\e[0m%}')"

# Vars
export EDITOR="vim"
export PAGER="vimpager"

# Setopts
setopt autocd
setopt autopushd pushdminus pushdsilent pushdtohome
setopt cdablevars
setopt nohup nocheckjobs # do not kill & spawned apps

# }}}
# ------------------------------
# Completion {{{

# }}}
# ------------------------------
# Aliases {{{

# Normal
alias pac="sudo pacman"
alias c="clear"
alias ls="ls --color --group -F"
alias ll="ls --color --group -lh"
alias cp="cp -v"
alias rm="rm -v"
alias grep="grep --color=auto"
alias ncmpc="ncmpc -c"
alias irc="irssi"

# Extensions
alias -s gif="feh"
alias -s jpg="feh"
alias -s png="feh"
alias -s avi="mplayer"

# }}}
# ------------------------------
# Functions {{{

# All in one archive extract
extract () {
  if [ -f $1 ] ; then
    case $1 in
      *.tar.bz2) tar xjf $1 ;;
      *.tar.gz) tar xzf $1 ;;
      *.bz2) bunzip2 $1 ;;
      *.rar) unrar e $1 ;;
      *.gz) gunzip $1 ;;
      *.tar) tar xf $1 ;;
      *.tbz2) tar xjf $1 ;;
      *.tgz) tar xzf $1 ;;
      *.zip) unzip "$1" ;;
      *.Z) uncompress $1 ;;
      *.7z) 7z x $1 ;;
      *) echo "'$1' cannot be extracted via extract()" ;;
    esac
  else
    echo "'$1' is not a valid file"
  fi
}

# }}}
# ------------------------------
# Keybindings {{{

bindkey -v
typeset -g -A key
#bindkey '\e[3~' delete-char
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
#bindkey '\e[2~' overwrite-mode
bindkey '^?' backward-delete-char
bindkey '^[[1~' beginning-of-line
bindkey '^[[5~' up-line-or-history
bindkey '^[[3~' delete-char
bindkey '^[[4~' end-of-line
bindkey '^[[6~' down-line-or-history
bindkey '^[[A' up-line-or-search
bindkey '^[[D' backward-char
bindkey '^[[B' down-line-or-search
bindkey '^[[C' forward-char 
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line

# }}}
# ------------------------------
# URXVT workaround - stop first line completion bug in tiling WMs{{{
if test "$TERM" = "rxvt-unicode"; then
  sleep 0.1 && clear
fi
# }}}