X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fskel%2F.zshrc;h=75cacc2d59b128011535154d9280c68299156da4;hb=fe2215ca407bc882da966f7393e05d2c3fee5f75;hp=1a51fa1de10239a130c720d990bc59e78838dba5;hpb=77190bf26c5ea55cfc3d4f7da080806cf022e70d;p=grml-etc-core.git diff --git a/etc/skel/.zshrc b/etc/skel/.zshrc index 1a51fa1..75cacc2 100644 --- a/etc/skel/.zshrc +++ b/etc/skel/.zshrc @@ -3,7 +3,7 @@ # 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 Mai 31 17:19:00 CEST 2007 [mika] +# Latest change: Mit Aug 08 21:22:03 CEST 2007 [mika] ################################################################################ # source ~/.zshrc.global {{{ @@ -48,10 +48,10 @@ if [ -z "$BROWSER" ] ; then if [ -n "$DISPLAY" ] ; then #v# If X11 is running - [ -x $(which firefox) ] && export BROWSER=firefox + [ -x $(type firefox) ] && export BROWSER=firefox else #v# If no X11 is running - [ -x $(which w3m) ] && export BROWSER=w3m + [ -x $(type w3m) ] && export BROWSER=w3m fi fi #v# @@ -197,7 +197,7 @@ #a2# Execute \kbd{mkdir -o} alias md='mkdir -p' - [ -x $(which ipython) ] && alias ips='ipython -p sh' + [ -x $(type ipython) ] && alias ips='ipython -p sh' # console stuff #a2# Execute \kbd{mplayer -vo fbdev} @@ -213,8 +213,13 @@ alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' alias insecscp='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' -# use colors when browsing man pages (if not using pinfo or PAGER=most) - [ -d ~/.terminfo/ ] && alias man='TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man' +# Use 'g' instead of 'git': + type g &>/dev/null || alias g='git' + +# use colors when browsing man pages, but only if not using LESS_TERMCAP_* from /etc/zsh/zshenv: + if [ -z "$LESS_TERMCAP_md" ] ; then + [ -d ~/.terminfo/ ] && alias man='TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man' + fi # check whether Debian's package management (dpkg) is running if type salias &>/dev/null ; then @@ -222,18 +227,18 @@ salias check_dpkg_running="dpkg_running" fi -# work around non utf8 capable software in utf environment - if type isutfenv &>/dev/null ; then - if [ -x $(which mrxvt) ] ; then - isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt" +# work around non utf8 capable software in utf environment via $LANG and luit + if type isutfenv &>/dev/null && type luit &>/dev/null; then + if [ -x $(type mrxvt) ] ; then + isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} luit mrxvt" fi - - if [ -x $(which aterm) ] ; then - isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm" + + if [ -x $(type aterm) ] ; then + isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} luit aterm" fi - - if [ -x $(which centericq) ] ; then - isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq" + + if [ -x $(type centericq) ] ; then + isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} luit centericq" fi fi # }}} @@ -268,9 +273,10 @@ #f4# Search German Wikipedia wikide () { ${=BROWSER} http://de.wikipedia.org/wiki/"${(C)*}" } #f4# Search English Wikipedia - wikien() { ${=BROWSER} http://en.wikipedia.org/wiki/"$*" } + wikien() { ${=BROWSER} http://en.wikipedia.org/wiki/"${(C)*}" } #f4# Search official debs - wodeb () { ${=BROWSER} "http://packages.debian.org/cgi-bin/search_contents.pl?word=$1&version=${2:-unstable}" } + wodeb () { ${=BROWSER} "http://packages.debian.org/search?keywords=$1&searchon=contents&suite=${2:=unstable}§ion=all" } + #m# f4 gex() Exact search via Google which google &>/dev/null && gex () { google "\"[ $1]\" $*" } # exact search at google @@ -816,7 +822,7 @@ echo "Downloading debian package of skype." echo "Notice: If you want to use a more recent skype version run 'getskypebeta'." wget http://www.skype.com/go/getskype-linux-deb - $SUDO dpkg -i skype_debian-*.deb && echo "skype installed." + $SUDO dpkg -i skype*.deb && echo "skype installed." } #f5# Install beta-version of skype @@ -902,7 +908,7 @@ # highlight important stuff in diff output, usage example: hg diff | hidiff #m# a2 hidiff \kbd{histring} oneliner for diffs - [ -x $(which histring) ] && \ + [ -x $(type histring) ] && \ alias hidiff="histring -fE '^Comparing files .*|^diff .*' | histring -c yellow -fE '^\-.*' | histring -c green -fE '^\+.*'" # rename pictures based on information found in exif headers @@ -971,7 +977,7 @@ # hl() highlighted less # http://ft.bewatermyfriend.org/comp/data/zsh/zfunct.html - if [ -x $(which highlight) ] ; then + if [ -x $(type highlight) ] ; then function hl() { local theme lang theme=${HL_THEME:-""} @@ -1061,6 +1067,45 @@ fi } +# retrieve weather information on the console +# Usage example: 'weather LOWG' + weather () { + [ -n "$1" ] || { + print 'Usage: weather ' >&2 + return 1 + } + + local PLACE="${1:u}" + local FILE="$HOME/.weather/$PLACE" + local LOG="$HOME/.weather/log" + + [ -d $HOME/.weather ] || { + print -n "Creating $HOME/.weather: " + mkdir $HOME/.weather + print 'done' + } + + print "Retrieving information for ${PLACE}:" + print + wget -T 10 --no-verbose --output-file=$LOG --output-document=$FILE --timestamping http://weather.noaa.gov/pub/data/observations/metar/decoded/$PLACE.TXT + + if [[ $? = 0 ]] ; then + if [ -n "$VERBOSE" ] ; then + cat $FILE + else + DATE=$(grep 'UTC' $FILE | sed 's#.* /##') + TEMPERATURE=$(awk '/Temperature/ { print $4" degree Celcius / " $2" degree Fahrenheit" }' $FILE| tr -d '(') + echo "date: $DATE" + echo "temp: $TEMPERATURE" + fi + else + print "There was an error retrieving the weather information for $PLACE" >&2 + cat $LOG + return 1 + fi + } + + # }}} # mercurial related stuff {{{ @@ -1145,7 +1190,7 @@ # Work around ion/xterm resize bug. #if [ "$SHLVL" = 1 ]; then -# if [ -x $(which resize) ]; then +# if [ -x $(type resize) ]; then # eval `resize