# 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: Sun Aug 03 20:23:34 CEST 2008 [mika]
################################################################################
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
return 0
}
-# Remove these functions again, they are of use only in these
-# setup files. This should be called at the end of .zshrc.
-xunfunction() {
- local -a funcs
- funcs=(salias xcat xsource xunfunction zrcautoload)
-
- for func in $funcs ; do
- [[ -n ${functions[$func]} ]] \
- && unfunction $func
- done
- return 0
-}
-
# autoload wrapper - use this one instead of autoload directly
function zrcautoload() {
setopt local_options extended_glob
# locale setup {{{
if [[ -z "$LANG" ]] ; then
- xsource "/etc/default/locale"
+ xsource "/etc/default/locale"
fi
export LANG=${LANG:-en_US.iso885915}
# 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 {{{
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}
# Ignore completion functions for commands you don't have:
zstyle ':completion::(^approximate*):*:functions' ignored-patterns '_*'
+ # Provide more processes in completion of programs like killall:
+ zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
+
# complete manual by their section
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
#m# f6 Stop() \kbd{/etc/init.d/\em{process}}\quad\kbd{stop}
#m# f6 Reload() \kbd{/etc/init.d/\em{process}}\quad\kbd{reload}
#m# f6 Force-Reload() \kbd{/etc/init.d/\em{process}}\quad\kbd{force-reload}
-if [[ -d /etc/init.d ]] ; then
+if [[ -d /etc/init.d || -d /etc/service ]] ; then
+ __start_stop() {
+ local action_="${1:l}" # e.g Start/Stop/Restart
+ local service_="$2"
+ local param_="$3"
+
+ local service_target_="$(readlink /etc/init.d/$service_)"
+ if [[ $service_target_ == "/usr/bin/sv" ]]; then
+ # runit
+ case "${action_}" in
+ start) if [[ ! -e /etc/service/$service_ ]]; then
+ $SUDO ln -s "/etc/sv/$service_" "/etc/service/"
+ else
+ $SUDO "/etc/init.d/$service_" "${action_}" "$param_"
+ fi ;;
+ # there is no reload in runits sysv emulation
+ reload) $SUDO "/etc/init.d/$service_" "force-reload" "$param_" ;;
+ *) $SUDO "/etc/init.d/$service_" "${action_}" "$param_" ;;
+ esac
+ else
+ # sysvinit
+ $SUDO "/etc/init.d/$service_" "${action_}" "$param_"
+ fi
+ }
+
for i in Start Restart Stop Force-Reload Reload ; do
- eval "$i() { $SUDO /etc/init.d/\$1 ${i:l} \$2 ; }"
+ eval "$i() { __start_stop $i \"\$1\" \"\$2\" ; }"
done
fi
# source another config file if present {{{
xsource "/etc/zsh/zshrc.local"
+xsource "${HOME}/.zshenv"
# }}}
# "persistent history" {{{