zsh: replace $(which ...) with $(type ...)
[grml-etc-core.git] / etc / skel / .zshrc
index a88afaa..75cacc2 100644 (file)
   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#
   #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}
   alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
   alias insecscp='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
 
+# 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'
 
 # 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 $(which mrxvt) ] ; 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
+     if [ -x $(type aterm) ] ; then
         isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} luit aterm"
      fi
 
-     if [ -x $(which centericq) ] ; then
+     if [ -x $(type centericq) ] ; then
         isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} luit centericq"
      fi
   fi
   #f4# Search English  Wikipedia
   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}&section=all" }
+
   #m# f4 gex() Exact search via Google
   which google &>/dev/null && gex () { google "\"[ $1]\" $*" } # exact search at google
 
     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
 
 # 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
 
 # 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:-""}
 
 # Work around ion/xterm resize bug.
 #if [ "$SHLVL" = 1 ]; then
-#       if [ -x $(which resize) ]; then
+#       if [ -x $(type resize) ]; then
 #               eval `resize </dev/null`
 #       fi
 #fi