zshrc: add (deactivated) MANWIDTH=80; fix colorschema in screenrc
[grml-etc-core.git] / etc / zsh / zshrc
index c740a02..820b064 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: Don Okt 18 10:22:10 CEST 2007 [mika]
+# Latest change: Don Nov 22 11:13:15 CET 2007 [mika]
 ################################################################################
 # This file is sourced only for interactive shells. It
 # should contain commands to set up aliases, functions,
 
 # {{{ set some variables
   #v#
-  export EDITOR=${EDITOR:-vim}
+  if type -p vim &>/dev/null ; then
+     export EDITOR=${EDITOR:-vim}
+  else
+     export EDITOR=${EDITOR:-vi}
+  fi
   #v#
+
   export MAIL=${MAIL:-/var/mail/$USER}
+
   # if we don't set $SHELL then aterm, rxvt,.. will use /bin/sh or /bin/bash :-/
   export SHELL='/bin/zsh'
+
+  # color setup for ls:
   [ -x $(which dircolors) ] && eval `dircolors -b`
 
-# Search path for the cd command
-#  cdpath=(.. ~)
+  # set width of man pages to 80 for more convenient reading
+  # (( ${+MANWIDTH} )) || export MANWIDTH=80
+
+  # Search path for the cd command
+  #  cdpath=(.. ~)
 
-# completion functions go to /etc/zsh/completion.d
-# function files may be put into /etc/zsh/functions.d, from where they
-# will be automatically autoloaded.
+  # completion functions go to /etc/zsh/completion.d
+  # function files may be put into /etc/zsh/functions.d, from where they
+  # will be automatically autoloaded.
   if [ -n "$BROKEN_COMPLETION_DIR" ] ; then
      print 'Warning: not setting completion directories because broken files have been found.'>&2
   else
      fi
   fi
 
-# automatically remove duplicates from these arrays
+  # automatically remove duplicates from these arrays
   typeset -U path cdpath fpath manpath
 # }}}
 
@@ -451,12 +462,20 @@ fi
          done
 
 # autoload zsh modules when they are referenced
-  is4 && for opt mod in a  stat    \
-                        a  zpty    \
-                        ap zprof   \
-                        ap mapfile ; do
-             zmodload -${opt} zsh/${mod} ${mod}
-         done ; unset opt mod
+  if is4 ; then
+    tmpargs=(
+      a   stat
+      a   zpty
+      ap  zprof
+      ap  mapfile
+    )
+
+    while (( ${#tmpargs} > 0 )) ; do
+      zmodload -${tmpargs[1]} zsh/${tmpargs[2]} ${tmpargs[2]}
+      shift 2 tmpargs
+    done
+    unset tmpargs
+  fi
 
   is4 && autoload -U insert-files && \
   zle -N insert-files && \