# ---------------------------------------------------------------------- # file: ~/.zshrc # author: christopher w. (moparx) - moparx.com # date: 2011/02/01 # vim:ai:si:ts=5:sw=5:et:nu:fdm=indent:fdn=1: # ---------------------------------------------------------------------- # zsh enviroment ------------------------------------------------------- export BROWSER="icecat" export EDITOR="vim" export VISUAL=$EDITOR export MAIL="~/.mail" export NNTPSERVER="snews://secure.news.us.easynews.com" export PATH=${PATH}:/usr/local/bin:/home/moparx/bin export PAGER="/usr/bin/most -s" export LESSOPEN="|lesspipe.sh %s" export INTEL_BATCH=1 # modules -------------------------------------------------------------- zstyle :compinstall filename '/home/moparx/.zshrc' autoload -U colors compinit promptinit autoload -U zcalc zmv colors compinit promptinit; prompt walters zmodload zsh/mathfunc zmodload zsh/complist zmodload zsh/zftp # terminal ------------------------------------------------------------- # if [[ "$TERM" = "rxvt-unicode" ]]; then # export TERM="rxvt" # fi # set terminal title case $TERM in xterm*|rxvt*|screen) precmd () {print -Pn "\e]0;%n@%m: %~\a"} ;; esac if [[ -f /etc/DIR_COLORS ]]; then eval `dircolors -b /etc/DIR_COLORS` fi # bindings ------------------------------------------------------------- bindkey -v bindkey ' ' magic-space bindkey "^r" history-incremental-search-backward bindkey '^I' complete-word bindkey '^[[2~' overwrite-mode bindkey "^[[3~" delete-char bindkey '^[[5~' up-line-or-history bindkey '^[[6~' down-line-or-history bindkey "^[[7~" beginning-of-line bindkey "^[[8~" end-of-line bindkey '^[Od' backward-word bindkey '^[Oc' forward-word # settings ------------------------------------------------------------- #umask 077 ulimit -S -c 0 HISTFILE=~/.histfile HISTSIZE=200 SAVEHIST=200 setopt append_history share_history extended_history setopt hist_ignore_all_dups hist_expire_dups_first hist_find_no_dups setopt hist_verify bang_hist hist_ignore_space inc_append_history setopt autopushd pushdminus pushdsilent pushdtohome nopromptcr setopt notify autolist rcquotes interactivecomments setopt autocd correct correctall extendedglob dvorak globdots setopt alwaystoend completeinword cdablevars chase_links numeric_glob_sort setopt autoresume check_jobs long_list_jobs # completion ----------------------------------------------------------- zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zsh/cache zstyle ':completion:*' _force_rehash zstyle ':completion:*' expand true zstyle ':completion:*' squeeze-slashes true zstyle ':completion:*' list-colors "$LS_COLORS" zstyle ':completion:*:cd:*' ignore-parents parent pwd zstyle ':completion:*' menu select=2 zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' zstyle ':completion:*' completer _expand _complete _match _approximate zstyle ':completion:*:match:*' original only zstyle ':completion:*:expand:*' tag-order all-expansions zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes # match uppercase from lowercase zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # kill!! muahahahhahaha zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' zstyle ':completion:*:kill:*' force-list always zstyle ':completion:*:kill:*' insert-ids single zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31" # ignore the following patterns zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS' zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS' zstyle ':completion:*:functions' ignored-patterns '_*' zstyle ':completion:*:*:*:users' ignored-patterns \ avahi bin bitlbee daemon dbus fetchmail ftp hal http mail mpd mysql \ nobody ntp postfix privoxy snort sshd tor # application completion zstyle ':completion:*:*:(g|)vim:*' menu yes select zstyle ':completion:*:*:most:*' menu yes select zstyle ':completion:*:*:mplayer:*' menu yes select zstyle ':completion:*:*:mplayer:*' file-sort time zstyle ':completion:*:*:mutt:*' menu yes select # add known hosts to SSH completion zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=( ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \ /dev/null)"}%%[# ]*}//,/ } )' zstyle ':completion:*:(ssh|scp):*' group-order 'users' 'hosts' # messages zstyle ':completion:*' group-name '' zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle ':completion:*' verbose yes zstyle ':completion:*:corrections' format $'%{\e[0;31m%}%B%d (errors: %e)%b%}' zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}%Bcompleting %d%b%{\e[0m%}' zstyle ':completion:*:messages' format '%d' zstyle ':completion:*:warnings' format $'%{\e[0;31m%}%BNo matches for:%{\e[0m%} %d%b' # aliases -------------------------------------------------------------- alias -s gz="tar -xzvf" alias -s bz2="tar -xjvf" alias -s zip="unzip" alias -s rar="rar x" alias -s {jpg,jpeg,png,gif}="feh --scale-down" alias -s {mp3,ogg,wav,flac}="mplayer" alias -s {mpg,mpeg,avi,ogm,wmv,m4v,mp4,mov,mkv}="mplayer" alias -s {html,php,com,net,org,gov}=$BROWSER alias -s txt=$EDITOR alias -s doc="catdoc" alias -s pdf="epdfview" alias -s xcf="gimp-remote" alias -g ...="../.." alias -g ....="../../.." alias -g .....="../../../.." alias :q="exit" alias :wq="exit" alias bc="bc -q" alias c='clear' alias cp="nocorrect cp -v" alias du="du -h --max-depth=1" alias df="df -h" alias e=$EDITOR alias grep="grep --color=auto -n" alias h="history" alias ht="htop -u $(whoami) -t" alias j="jobs" alias k="kill" alias l="ls" alias ls="ls -hF --color=auto --group-directories-first" alias mkdir='nocorrect mkdir' alias mv="nocorrect mv -v" alias netstat="netstat -nap --inet" alias nzb="hellanzb.py" alias pgrep="pgrep -l" alias q="exit" alias rm="nocorrect rm -v" alias recent="find . -mtime -1 | head -n 22" alias screen="screen -U" alias slrn="slrn -n" alias srm="srm -DRv" alias ss="scrot %Y-%m-%d_moparx.png -d 8 -c -t 576x230" alias x="dbus-launch startx -nolisten tcp" alias su="su -" alias syn="rsync -avz -h --progress --stats -e ssh --exclude-from=/home/moparx/.rsync/exclude --delete --delete-excluded /home/moparx/ /media/Storage/moparx" alias urxvt="urxvtc" alias vi="vim" alias vd="vimdiff" # swiped from another config since it is rather useful alias lad='ls -d .*(/)' # only show dot-directories alias lsa='ls -a .*(.)' # only show dot-files alias lss='ls -l *(s,S,t)' # only files with setgid/setuid/sticky flag alias lsl='ls -l *(@[1,10])' # only symlinks alias lsx='ls -l *(*[1,10])' # only executables alias lsw='ls -ld *(R,W,X.^ND/)' # world-{readable,writable,executable} files alias lsbig="ls -flh *(.OL[1,10])" # display the biggest files alias lsd='ls -d *(/)' # only show directories alias lse='ls -d *(/^F)' # only show empty directories alias lsnew="ls -rl *(D.om[1,10])" # display the newest files alias lsold="ls -rtlh *(D.om[1,10])" # display the oldest files alias lssmall="ls -Srl *(.oL[1,10])" # display the smallest files alias rw-='chmod 600' alias rwx='chmod 700' alias r--='chmod 644' alias r-x='chmod 755' alias twit='mplayer -aspect 16:9 http://bglive-a.bitgravity.com/twit/live/high' # functions ------------------------------------------------------------ _force_rehash() { (( CURRENT == 1 )) && rehash return 1 } function calc { echo $(( $* )) } makepasswords() { perl <$%&()*^})); for (1..12) { print join "", map { \$a[rand @a] } (1..rand(3)+20); print qq{\n} } EOPERL } src () { autoload -U zrecompile [ -f ~/.zshrc ] && zrecompile -p ~/.zshrc [ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump [ -f ~/.zshrc.zwc.old ] && rm -f ~/.zshrc.zwc.old [ -f ~/.zcompdump.zwc.old ] && rm -f ~/.zcompdump.zwc.old source ~/.zshrc }