merged
[grml-etc-core.git] / etc / zsh / zshrc
index 3554d99..2e60119 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: Mon Feb 11 18:00:55 CET 2008 [mika]
+# Latest change: Sam Mai 17 22:52:34 CEST 2008 [mika]
 ################################################################################
 # This file is sourced only for interactive shells. It
 # should contain commands to set up aliases, functions,
@@ -352,7 +352,7 @@ zrcautoload is-at-least || is-at-least() { return 1 }
 
 # locale setup {{{
 if [[ -z "$LANG" ]] ; then
-    xsource "/etc/default/locale"
+   xsource "/etc/default/locale"
 fi
 
 export LANG=${LANG:-en_US.iso885915}
@@ -502,6 +502,24 @@ bindkey '^Xi' insert-unicode-char
 #  bindkey . rationalise-dot
 
 #  bindkey '\eq' push-line-or-edit
+
+## toggle the ,. abbreviation feature on/off
+# NOABBREVIATION: default abbreviation-state
+#                 0 - enabled (default)
+#                 1 - disabled
+NOABBREVIATION=${NOABBREVIATION:-0}
+
+grml_toggle_abbrev() {
+    if (( ${NOABBREVIATION} > 0 )) ; then
+        NOABBREVIATION=0
+    else
+        NOABBREVIATION=1
+    fi
+}
+
+zle -N grml_toggle_abbrev
+bindkey '^xA' grml_toggle_abbrev
+
 # }}}
 
 # a generic accept-line wrapper {{{
@@ -729,6 +747,12 @@ abk=(
 
 globalias() {
     local MATCH
+
+    if (( NOABBREVIATION > 0 )) ; then
+        LBUFFER="${LBUFFER},."
+        return 0
+    fi
+
     matched_chars='[.-|_a-zA-Z0-9]#'
     LBUFFER=${LBUFFER%%(#m)[.-|_a-zA-Z0-9]#}
     LBUFFER+=${abk[$MATCH]:-$MATCH}
@@ -2043,6 +2067,7 @@ for color in BLUE RED GREEN CYAN WHITE ; unset $color
 
 # source another config file if present {{{
 xsource "/etc/zsh/zshrc.local"
+xsource "${HOME}/.zshenv"
 # }}}
 
 # "persistent history" {{{