deactivate zsh-mime-setup by default
[grml-etc-core.git] / etc / skel / .zshrc
index ebe54fe..10f900e 100644 (file)
@@ -3,7 +3,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Sam Mai 12 23:22:28 CEST 2007 [mika]
+# Latest change: Don Mai 31 17:19:00 CEST 2007 [mika]
 ################################################################################
 
 # source ~/.zshrc.global {{{
   fi
 # }}}
 
+# 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
+  fi
+# }}}
+
+# autoloading stuff {{{
+# associate types and extensions (be aware with perl scripts and anwanted behaviour!)
+#  type zsh-mime-setup &>/dev/null || { autoload zsh-mime-setup && zsh-mime-setup }
+# }}}
+
 # completion system {{{
 # just make sure it is loaded in this file too
   type compinit &>/dev/null || { autoload -U compinit && compinit }
 # some useful aliases
   alias md='mkdir -p'
 
+  [ -x $(which ipython) ] && alias ips='ipython -p sh'
+
 # console stuff
   alias cmplayer='mplayer -vo fbdev'
   alias fbmplayer='mplayer -vo fbdev -fs -zoom'
   [ -d ~/.terminfo/ ] && alias man='TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man'
 
 # check whether Debian's package management (dpkg) is running
-  salias check_dpkg_running="dpkg_running"
+  type salias &>/dev/null && salias check_dpkg_running="dpkg_running"
 
 # work around non utf8 capable software in utf environment
-  if [ -x /usr/bin/mrxvt ] ; then
-     isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt"
-  fi
-
-  if [ -x /usr/bin/aterm ] ; then
-     isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm"
-  fi
-
-  if [ -x /usr/bin/centericq ] ; then
-     isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq"
+  if type isutfenv &>/dev/null ; then
+     if [ -x $(which mrxvt) ] ; then
+        isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt"
+     fi
+   
+     if [ -x $(which aterm) ] ; then
+        isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm"
+     fi
+   
+     if [ -x $(which centericq) ] ; then
+        isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq"
+     fi
   fi
 # }}}
 
 # Function Usage: doc packagename
   doc() { cd /usr/share/doc/$1 && ls }
   _doc() { _files -W /usr/share/doc -/ }
-  compdef _doc doc
+  type compdef &>/dev/null && compdef _doc doc
 
 # make screenshot of current desktop (use 'import' from ImageMagic)
   sshot() {
 
 # hl() highlighted less
 # http://ft.bewatermyfriend.org/comp/data/zsh/zfunct.html
-  if [[ -x $(which highlight) ]] ; then
+  if [ -x $(which highlight) ] ; then
     function hl() {
       local theme lang
       theme=${HL_THEME:-""}
     | sed 's/value=//;s/"//g'
 }
 
+# change fluxbox keys from 'Alt-#' to 'Alt-F#' and vice versa
+  fluxkey-change() {
+    [ -n "$FLUXKEYS" ] || local FLUXKEYS="$HOME/.fluxbox/keys"
+    if ! [ -r "$FLUXKEYS" ] ; then
+       echo "Sorry, \$FLUXKEYS file $FLUXKEYS could not be read - nothing to be done."
+       return 1
+    else
+       if grep -q 'Mod1 F[0-9] :Workspace [0-9]' $FLUXKEYS ; then
+          echo -n 'Switching to Alt-# mode in ~/.fluxbox/keys: '
+          sed -i -e 's|^\(Mod[0-9]\+[: space :]\+\)F\([0-9]\+[: space :]\+:Workspace.*\)|\1\2|' $FLUXKEYS && echo done || echo failed
+       elif grep -q 'Mod1 [0-9] :Workspace [0-9]' $FLUXKEYS ; then
+          echo -n 'Switching to Alt-F# mode in ~/.fluxbox/keys: '
+          sed -i -e 's|^\(Mod[0-9]\+[: space :]\+\)\([0-9]\+[: space :]\+:Workspace.*\)|\1F\2|' $FLUXKEYS && echo done || echo failed
+       else
+          echo 'Sorry, do not know what to do.'
+          return 1
+       fi
+    fi
+  }
+
 # }}}
 
 # mercurial related stuff {{{
 
 # Work around ion/xterm resize bug.
 #if [ "$SHLVL" = 1 ]; then
-#       if [ -x `which resize 2>/dev/null` ]; then
+#       if [ -x $(which resize) ]; then
 #               eval `resize </dev/null`
 #       fi
 #fi