apply "PATCH: vcs_info, implement disable-patterns style (2nd try)" from ft
[grml-etc-core.git] / etc / zsh / zshrc
index 96c890a..258ee0e 100644 (file)
@@ -102,6 +102,40 @@ NOPRECMD=${NOPRECMD:-0}
 BATTERY=${BATTERY:-0}
 GRMLSMALL_SPECIFIC=${GRMLSMALL_SPECIFIC:-1}
 GRML_ALWAYS_LOAD_ALL=${GRML_ALWAYS_LOAD_ALL:-0}
+GRML_WARN_SKEL=${GRML_WARN_SKEL:-1}
+
+if (( GRML_WARN_SKEL != 0 )) ; then
+    printf '
+Dear user,
+
+You updated grml'\''s zshrc which brings a major change.
+The configuration is kept only in one file, being the global zshrc.
+In the past, the configuration was split in two files, with the
+second file being the .zshrc file from /etc/skel.
+
+If you have a .zshrc file in your home directory that originally
+came from the skel directory, please remove it. This is also the case
+if you followed earlier instructions from the grml-zsh-refcard or
+from <http://grml.org/console> on non-grml systems.
+
+Please see the current grml-zsh-refcard for updated installation
+information. In short, you don'\''t want a .zshrc.global file. Install
+the global zshrc to ~/.zshrc and be done.
+
+If you need changes to the configuration, use ~/.zshrc.pre and
+~/.zshrc.local.
+
+To remove this warning execute '\''grml_do_not_warn_skel'\''.
+
+' | more
+
+function grml_do_not_warn_skel() {
+    printf '# Do not warn about old skel dot-files anymore\n' >>! ~/.zshrc.pre
+    printf 'GRML_WARN_SKEL=0\n' >>! ~/.zshrc.pre
+}
+
+fi
+
 # }}}
 
 # {{{ check for version/system
@@ -152,6 +186,11 @@ else
     isgrmlsmall() { return 1 }
 fi
 
+isdarwin(){
+    [[ $OSTYPE == darwin* ]] && return 0
+    return 1
+}
+
 #f1# are we running within an utf environment?
 isutfenv() {
     case "$LANG $CHARSET $LANGUAGE" in
@@ -427,6 +466,18 @@ export SHELL='/bin/zsh'
 
 # color setup for ls:
 check_com -c dircolors && eval $(dircolors -b)
+# color setup for ls on OS X:
+isdarwin && export CLICOLOR=1
+
+# do MacPorts setup on darwin
+if isdarwin && [[ -d /opt/local ]]; then
+    # Note: PATH gets set in /etc/zprofile on Darwin, so this can't go into
+    # zshenv.
+    PATH="/opt/local/bin:/opt/local/sbin:$PATH"
+    MANPATH="/opt/local/share/man:$MANPATH"
+fi
+# do Fink setup on darwin
+isdarwin && xsource /sw/bin/init.sh
 
 # set width of man pages to 80 for more convenient reading
 # export MANWIDTH=${MANWIDTH:-80}
@@ -1213,6 +1264,11 @@ zstyle ':vcs_info:*' max-exports 1
 #   disable             - Provide a list of systems, you don't want
 #                         the vcs_info() to check for repositories
 #                         (checked in the 'init' context, too).
+#   disable-patterns    - A list of patterns that are checked against $PWD.
+#                         If the pattern matches, vcs_info will be disabled.
+#                         Say, ~/.zsh is a directory under version control,
+#                         in which you do not want vcs_info to be active, do:
+#                         zstyle ':vcs_info:*' disable-patterns "$HOME/.zsh+(|/*)"
 #   use-simple          - If there are two different ways of gathering
 #                         information, you can select the simpler one
 #                         by setting this style to true; the default
@@ -1233,6 +1289,7 @@ zstyle ':vcs_info:*' max-exports 1
 #   max-exports         2
 #   enable              true
 #   disable             (empty list)
+#   disable-patterns    (empty list)
 #   use-simple          false
 #   use-prompt-escapes  true
 #
@@ -1797,8 +1854,9 @@ vcs_info_lastmsg () { # {{{
 }
 # }}}
 vcs_info () { # {{{
+    local pat
     local -i found
-    local -a VCSs disabled
+    local -a VCSs disabled dps
     local -x vcs usercontext
     local -ax msgs
     local -Ax vcs_comm
@@ -1831,6 +1889,15 @@ vcs_info () { # {{{
         return 0
     }
     zstyle -a ":vcs_info:${vcs}:${usercontext}" "disable" disabled
+
+    zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable-patterns" dps
+    for pat in ${dps} ; do
+        if [[ ${PWD} == ${~pat} ]] ; then
+            [[ -n ${vcs_info_msg_0_} ]] && VCS_INFO_set --clear
+            return 0
+        fi
+    done
+
     VCS_INFO_maxexports
 
     (( found = 0 ))
@@ -2929,11 +2996,6 @@ if [[ -r ~/.important_commands ]] ; then
 fi
 # }}}
 
-## genrefcard.pl settings {{{
-### example: split functions-search 8,16,24,32
-#@# split functions-search 8
-## }}}
-
 #:grep:marker:for:mika: :-)
 ### non-root (EUID != 0) code below
 ###
@@ -4267,9 +4329,15 @@ xsource "${HOME}/.zshrc.local"
 
 # }}}
 
-### doc strings for external functions from files {{{
+## genrefcard.pl settings {{{
+
+### doc strings for external functions from files
 #m# f5 grml-wallpaper() Sets a wallpaper (try completion for possible values)
-#}}}
+
+### example: split functions-search 8,16,24,32
+#@# split functions-search 8
+
+## }}}
 
 ## END OF FILE #################################################################
 # vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4