X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fskel%2F.zshrc;h=57bbbb96dd0af281b0b985043e6fdb1111c60994;hb=7c4b6b5094b2c0e7767b8de927af3c71ca0daf15;hp=a8eb45272a487f0f9656fedc15c1c7e95ebe4624;hpb=9b7b15ea36e0e6227cdec1274f836b0dcf39638e;p=grml-etc-core.git diff --git a/etc/skel/.zshrc b/etc/skel/.zshrc index a8eb452..57bbbb9 100644 --- a/etc/skel/.zshrc +++ b/etc/skel/.zshrc @@ -3,23 +3,27 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Don Dez 06 23:27:51 CET 2007 [mika] +# Latest change: Son Dez 09 22:58:07 CET 2007 [mika] ################################################################################ # source ~/.zshrc.global {{{ + # see /etc/zsh/zshrc for some general settings # If you don't have write permissions to /etc/zsh/zshrc on your own # copy the file to your $HOME as /.zshrc.global and we source it: -if type xsource &>/dev/null ; then - xsource "${HOME}/.zshrc.global" -else - . "${HOME}/.zshrc.global" -fi + +# Note, that xsource() is defined in the global file, so here, +# we will have to do the sourcing manually for once: + +[[ -z "$ZSHRC_GLOBAL_HAS_BEEN_READ" ]] \ +&& [[ -r "${HOME}/.zshrc.global" ]] \ +&& source "${HOME}/.zshrc.global" # }}} # check whether global file has been read {{{ if [[ -z "$ZSHRC_GLOBAL_HAS_BEEN_READ" ]] ; then - print 'Warning: global zsh config has not been read'>&2 + print 'Warning: global zsh config has not been read.' >&2 + print ' prepare for possible errors!' >&2 fi # }}} @@ -253,7 +257,25 @@ fi #f4# Search for newspostings from authors agoogle() { ${=BROWSER} "http://groups.google.com/groups?as_uauthors=$*" ; } #f4# Search Debian Bug Tracking System by BugID in mbox format -debbug() { ${=BROWSER} "http://bugs.debian.org/$*" } +debbug() { + setopt localoptions extendedglob + if [[ $# -eq 1 ]]; then + case "$1" in + ([0-9]##) + ${=BROWSER} "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=$1" + ;; + (*@*) + ${=BROWSER} "http://bugs.debian.org/cgi-bin/pkgreport.cgi?submitter=$1" + ;; + (*) + ${=BROWSER} "http://bugs.debian.org/$*" + ;; + esac + else + print "$0 needs one argument" + return 1 + fi +} #f4# Search Debian Bug Tracking System debbugm() { bts show --mbox $1 } # provide bugnummer as "$1" #f4# Search DMOZ @@ -582,39 +604,6 @@ show-archive() { fi } -# TODO: isn't ssl() like this, but clean? -# I'd like to remove this, it's a gross hack, IMHO -ft -#f5# Follow symlinks -folsym() { - if [[ -e $1 || -h $1 ]] ; then - file=$1 - else - file=`which $1` - fi - if [[ -e $file || -L $file ]] ; then - if [[ -L $file ]] ; then - echo `ls -ld $file | perl -ane 'print $F[7]'` '->' - folsym `perl -le '$file = $ARGV[0]; - $dest = readlink $file; - if ($dest !~ m{^/}) { - $file =~ s{(/?)[^/]*$}{$1$dest}; - } else { - $file = $dest; - } - $file =~ s{/{2,}}{/}g; - while ($file =~ s{[^/]+/\.\./}{}) { - ; - } - $file =~ s{^(/\.\.)+}{}; - print $file' $file` - else - ls -d $file - fi - else - echo $file - fi -} - # It's shameless stolen from #f5# Use \kbd{vim} as your manpage reader vman() { man $* | col -b | view -c 'set ft=man nomod nolist' - } @@ -1075,6 +1064,7 @@ fluxkey-change() { weather() { [[ -n "$1" ]] || { print 'Usage: weather ' >&2 + print 'List of stations: http://en.wikipedia.org/wiki/List_of_airports_by_ICAO_code'>&2 return 1 } @@ -1247,11 +1237,7 @@ gethgsnap() { # this allows us to stay in sync with /etc/skel/.zshrc # through 'ln -s /etc/skel/.zshrc ~/.zshrc' and put own # modifications in ~/.zshrc.local -if type xsource &>/dev/null ; then - xsource "${HOME}/.zshrc.local" -else - . "${HOME}/.zshrc.local" -fi +xsource "${HOME}/.zshrc.local" # ...and remove utility functions again. xunfunction