# 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: Son Okt 29 17:49:13 CET 2006 [mika]
+# Latest change: Son Nov 19 14:45:18 CET 2006 [mika]
################################################################################
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
# {{{ check for version/system
# check for versions (compatibility reasons)
- if autoload is-at-least && is-at-least ; then
+ if autoload is-at-least && is-at-least 2>/dev/null ; then
is4() { is-at-least 4 }
is42() { is-at-least 4.2 }
else
# cdpath=(.. ~)
# Support our own site-functions
- [ -d /etc/zsh/site-functions ] && export FPATH=/etc/zsh/site-functions:$FPATH
+ [ -d /etc/zsh/site-functions ] && FPATH=/etc/zsh/site-functions:$FPATH
# automatically remove duplicates from these arrays
typeset -U path cdpath fpath manpath
# we don't want to quote/espace URLs on our own...
# avoid 'url-quote-magic: function definition file not found' on some older boxes
- if [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Zle/url-quote-magic" ] ; then
- autoload -U url-quote-magic && zle -N self-insert url-quote-magic
+ if [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Zle/url-quote-magic" ] && \
+ autoload -U url-quote-magic && zle -N self-insert url-quote-magic ; then
+ zle -N self-insert url-quote-magic
else
print 'Notice: no url-quote-magic available :('
fi
autoload run-help # use via 'esc-h'
# completion system
- is42 && if autoload -U compinit && [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Completion/compinit" ] ; then
+ if autoload -U compinit && [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Completion/compinit" ] && compinit 2>/dev/null ; then
compinit
else
print 'Notice: no compinit available :('
zle -N edit-command-line && \
bindkey '\ee' edit-command-line
-## menu selection: pick item but stay in the menu (press esc-return)
+# menu selection: pick item but stay in the menu (press esc-return)
is4 && bindkey -M menuselect '\e^M' accept-and-menu-complete
# press "ctrl-e d" to insert the actual date in the form yyyy-mm-dd
# }}}
# {{{ set prompt
- if [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Prompts/promptinit" ] ; then
- autoload promptinit && promptinit # people should be able to use their favourite prompt
+ if [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Prompts/promptinit" ] && autoload promptinit && promptinit 2>/dev/null ; then
+ promptinit # people should be able to use their favourite prompt
else
- print 'Notice: no prompiinit available :('
+ print 'Notice: no promptinit available :('
fi
# precmd() => a function which is executed just before each prompt
# precmd () { setopt promptsubst; [[ -o interactive ]] && jobs -l;
}
# set colors
- if autoload colors && colors ; then
+ if autoload colors && colors 2>/dev/null ; then
BLUE="%{${fg[blue]}%}"
RED="%{${fg_bold[red]}%}"
GREEN="%{${fg[green]}%}"
Main configuration of zsh happens in /etc/zsh/zshrc (global)
and /etc/skel/.zshrc which is copied to \$HOME/.zshrc once.
-The files are part of the package grml-etc, if you want to
+The files are part of the package grml-etc-core, if you want to
use them on a non-grml-system just get the tar.gz from
-http://grml.org/repos/
+http://grml.org/repos/ or get the files from the mercurial
+repository:
+
+ http://hg.grml.org/grml-etc-core/raw-file/tip/etc/skel/.zshrc
+ http://hg.grml.org/grml-etc-core/raw-file/tip/etc/zsh/zshrc
If you want to stay in sync with zsh configuration of grml
run 'ln -sf /etc/skel/.zshrc \$HOME/.zshrc' and configure
# debian stuff
if [ -r /etc/debian_version ] ; then
- alias acs="apt-cache search"
- alias acsh="apt-cache show"
+ alias acs='apt-cache search'
+ alias acsh='apt-cache show'
+ alias acp='apt-cache policy'
alias adg="$SUDO apt-get dist-upgrade"
alias agi="$SUDO apt-get install"
alias ag="$SUDO apt-get upgrade"
alias au="$SUDO apt-get update"
- alias dbp="dpkg-buildpackage"
- alias ge="grep-excuses"
+ alias dbp='dpkg-buildpackage'
+ alias ge='grep-excuses'
+
+ # debian upgrade
+ upgrade () {
+ if [ -z "$1" ] ; then
+ $SUDO apt-get update
+ $SUDO apt-get -u upgrade
+ else
+ ssh $1 $SUDO apt-get update
+ # ask before the upgrade
+ local dummy
+ ssh $1 $SUDO apt-get --no-act upgrade
+ echo -n 'Process the upgrade?'
+ read -q dummy
+ if [[ $dummy == "y" ]] ; then
+ ssh $1 $SUDO apt-get -u upgrade --yes
+ fi
+ fi
+ }
isgrmlcd && alias su="sudo su" # change to user root
alias tlog="tail -f /var/log/syslog" # take a look at the syslog
# {{{ Use hard limits, except for a smaller stack and no core dumps
unlimit
limit stack 8192
- limit core 0 # important for a live-cd-system
+ isgrmlcd && limit core 0 # important for a live-cd-system
limit -s
# }}}
alias grml-version='cat /etc/grml_version'
if [ -x /usr/sbin/rebuildfstab ] ; then
- local fstabuser=$(getent passwd 1000 | cut -d: -f1)
- alias grml-rebuildfstab="rebuildfstab -v -r -u $fstabuser -g $fstabuser"
+ alias grml-rebuildfstab='rebuildfstab -v -r -config'
fi
}
# }}}
# use it e.g. via 'Restart apache2'
if [ -d /etc/init.d ] ; then
- for i in Start Restart Stop Reload ; do
+ for i in Start Restart Stop Force-Reload Reload ; do
eval "$i() { $SUDO /etc/init.d/\$1 ${i:l} \$2 ; }"
done
# now the completion for this:
- compctl -g "$(echo /etc/init.d/*(:t))" Start Restart Stop Reload
+ compctl -g "$(echo /etc/init.d/*(:t))" Start Restart Stop Force-Reload Reload
fi
# }}}