# # .zshrc # ############################################## # Exports # ############################################ export PATH=~/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin export PS1="%B[%b%n@%m:%30< .. <%~%B] %#%b " export RPS1="%B[%b%T%B]" export DEBFULLNAME="My full name" export DEBEMAIL="my@debian.address" export IRCNICK="Fluor" export IRCNAME="fnurk!" export IRCSERVER="irc.xs4all.nl:6666" export LS_OPTIONS="--color=auto" export LANG=nl_NL.UTF-8 export LC_MESSAGES=en_US.UTF-8 export LC_COLLATE=C eval `dircolors` export LS_COLORS="$LS_COLORS" export EDITOR="vim" export READNULLCMD="less" # < filename causes 'less filename' export LESS="-cSR" # Less does full repaint of screen. export LESSCHARSET="utf-8" # Use latin1 for displaying files with less export GZIP="-9" # Always use max compression with gzip eval `lesspipe` # less file-preprocessor (man 1 lesspipe) ###################################################### # Keys, Aliases & General # #################################################### mesg n umask 077 bindkey '^Z' undo bindkey '^A' vi-beginning-of-line bindkey '^E' vi-end-of-line bindkey '^[OH' vi-beginning-of-line bindkey '^[OF' vi-end-of-line bindkey '^[[^@' vi-beginning-of-line bindkey '^[[e' vi-end-of-line bindkey '^[[1~' vi-beginning-of-line bindkey '^[[2~' overwrite-mode bindkey '^[[4~' vi-end-of-line bindkey '^[[H' vi-beginning-of-line bindkey '^[[F' vi-end-of-line bindkey '^[[5~' up-history bindkey '^[[6~' down-history bindkey '^[[29~' list-choices alias ls='ls $LS_OPTIONS' alias vi=vim alias popd='popd >&/dev/null' alias slrn='slrn -n' alias exim='exim4' ################################################# # Kinky ZSH Shit # ################################################ bindkey -e # Select emacs keymaps (eg. no vi mode) compctl -C -cm # Set up completion: # - Command names, aliases, functions, # builtins, reserved words & externals unsetopt promptcr # Fixes that prompt doesn't overwrite last # line of program output that hasn't a \n # like: echo -n "blaa" setopt autocd # If issuing a command that is a directory # name, automatically CD into that dir setopt autopushd # Let CD push curdir to stack, so you can # do easy popd's to get back your cd path unsetopt beep # Don't beep on ZLE errors setopt bsdecho # Treat \033 in a echo as string, unless -e setopt nocheckjobs # Don't check for running tasks when ^D'ing out setopt nohup # and don't kill running tasks if ^D'ing out setopt nocorrect # Don't ask for correction: 'sl' -> 'ls' setopt nocorrectall # Don't ever ask to correct statements setopt equals # Allow 'echo =micq' to return '/usr/bin/micq' setopt listpacked # Show smaller lists of completion options by # by using different fieldwidths (less lines) setopt longlistjobs # Always do jobs -l (more information) setopt printexitvalue # Print exit status of prgs returning nonzero state setopt rcexpandparam # Array expansions of the form `foo${xx}bar', # where the parameter xx is set to (a b c), # are substituted with `fooabar foobbar foocbar' # instead of the default `fooa b cbar'. #setopt xtrace # Show commands (after shellexpansion) before executing setopt magicequalsubst # Subst all ~ in for ex. echo foo=~/bar:~/rod to full path to homedir setopt completeinword # Allow fbar to expand to foobar when on 'b' ##################################################### # const for completions # ################################################### # used for chgrp chown and newgrp groups=( $(cut -d: -f1 /etc/group) ) # used for man expansion c_man_var() { man_pages=( /usr/share/man/man*/*(N:t:r) /usr/man/man*/*(N:t:r) ) compctl -k man_pages man reply=( $man_pages ) } # uses for ssh/scp expansion, extract the hosts which are known to ssh. function c_ssh_knownhosts { reply=(`sed -e 's/ .*$//' -e 's/,[0-9]\{3\}\..*//' ~/.ssh/known_hosts`); } function replymake { if [[ -r Makefile ]] then reply=(`sed -n "s/^\([0-9A-Za-z_/.-]*\):.*/\1/p" Makefile`) else reply=() fi } ############################################################# # compctl muck to make zsh more AI like # ########################################################### # make targets completion compctl -K replymake -g '*.c(:r)' -x 'c[-1,-f][-1,-o][-1,-W]' -f - 'c[-1,-I][-1,-C],s[-I]' -g '*(/)' -- make # complete most common ./configure parameters compctl -x 's[--]' -S '' -k '(verbose\ prefix= exec-prefix= help\ build= host= norecursion\ program-prefix= program-suffix= program-transform-name= site= srcdir= target= tmpdir= with- without- enable- disable- )' -- \ ./configure # scp completion compctl -x 'n[0,:]' -f - 'n[0,@],s[]' -K c_ssh_knownhosts -S: + -f -- scp # ssh completion compctl -x 'C[-1,*@*]' -X '' - 'n[0,@],s[]' -K c_ssh_knownhosts -- ssh # Complete commands, otherwise complete by search of $MANPATH for man compctl -x 'S[1][2][3][4][5][6][7][8][9]' -k '(1 2 3 4 5 6 7 8 9)' \ - 'R[[1-9nlo]|[1-9](|[a-z]),^*]' -K 'match-man' \ - 's[-M],c[-1,-M]' -g '*(-/)' \ - 's[-P],c[-1,-P]' -c \ - 's[-S],s[-1,-S]' -k '( )' \ - 's[-l],c[-1,-l]' -g '*.[0-9] *.man' \ - 's[-T]' -k '(X100 X75 ascii latin1 ps X100-12 X75-12 dvi lj4)' \ - 's[-]' -k '(a d f h k t M P l)' \ - 'p[1,-1]' -c + -K 'c_man_var' \ -- man # Complete files, options (both - and -- kind), and option params for ls & dir compctl -f \ -x s'[--format]' -P '=' -k '(long verbose commas horizontal across vertical single-column)' \ - s'[--sort]' -P '=' -k '(none time size extension)' \ - s'[--time]' -P '=' -k '(atime ctime access use status)' \ - s'[--width=][--tabsize=][--ignore=][-w][-T][-I],c[-1,-w][-1,-T][-1,-I]' \ -k '( )' \ - s'[--]' -S '' -k '(all\ escape\ directory\ inode\ kilobytes\ numeric-uid-gid\ no-group\ hide-control-chars\ reverse\ size\ width= tabsize= almost-all\ ignore-backups\ classify\ file-type\ full-time\ ignore= dereference\ literal\ quote-name\ dired\ no-color\ 7bit\ 8bit\ recursive\ sort= format= time= no-group\ help\ version\ )' \ - s'[-]' -k '(a b c d f g i k l m n o p q r s t u x A B C F G L N Q R S U X 1 w T I)' \ -- ls dir # Show groups when doing chgrp / chown / newgrp compctl -s '$(groups)' + -k groups newgrp compctl -f -x 'p[1], p[2] C[-1,-*]' -k groups -- chgrp compctl -f -x 'p[1] n[-1,.], p[2] C[-1,-*] n[-1,.]' -k groups \ - 'p[1], p[2] C[-1,-*]' -u -S '.' -- chown # Let 'which' completion expand to everything in your path instead of curdir compctl -c which # Show a list of backgrounded tasks for fg, kill, disown and jobs compctl -j -P "%" fg kill disown jobs # Show a list of suspended tasks for bg compctl -z -P "%" bg # complete keywords for limit compctl -k "(cputime filesize datasize stacksize coredumpsize resident descriptors)" limit # complete all the possible environment variables after 'set ' compctl -v setenv getenv set export # show only *.mp[321] as filematches for mpg123, mpg321 and xmms compctl -g '*.(mp(3|)(g|)|MP(3|(G|)))[321]' mpg123 mpg321 xmms mplayer # show all know image types to image viewers compctl -g '*.(gif|tiff|jpeg|jpg|tif|pcx|targa|bmp|xpm|rgb|iff)' gqview display xv # only complete directories when doing cd / chdir / rmdir compctl -/ cd chdir rmdir ############################################### # Other Muck # ############################################## # a nice fortune when opening an xterm. if [ -e /usr/games/fortune ]; then echo "" /usr/games/fortune echo "" fi