X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=ff2fe2c3e65b0ee74c332390e1470472a70e67b7;hb=44caa64f88f6786d44c5e3c95d1e12c5e5e0890e;hp=936c704cfd8ee737c9abf5cf7d1d0e8504a9caf5;hpb=828609514e739f7626c91daddc7dfe7c10807ae9;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 936c704..ff2fe2c 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -3,7 +3,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sam Okt 21 16:20:30 CEST 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, @@ -14,16 +14,19 @@ # {{{ check for version/system # check for versions (compatibility reasons) - is4(){ - [[ $ZSH_VERSION == 4.* ]] && return 0 - return 1 - } - -# current release - is42(){ - [[ $ZSH_VERSION == 4.<2->* ]] && return 0 - return 1 - } + if autoload is-at-least && is-at-least 2>/dev/null ; then + is4() { is-at-least 4 } + is42() { is-at-least 4.2 } + else + is4(){ + [[ $ZSH_VERSION == 4.* ]] && return 0 + return 1 + } + is42(){ + [[ $ZSH_VERSION == 4.<2->* ]] && return 0 + return 1 + } + fi # grml specific stuff isgrml(){ @@ -36,6 +39,14 @@ return 1 } + if isgrml ; then + isgrmlsmall() { + [[ ${${${(f)"$(/dev/null ; then compinit else print 'Notice: no compinit available :(' @@ -276,19 +287,21 @@ fi # }}} # {{{ 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; # run 'NOPRECMD=1 zsh' to disable the precmd + preexec commands is4 && ! [[ -n "$NOPRECMD" ]] && precmd () { if [ -n "$BATTERY" ] ; then - RPROMPT="%(?..:()% ${PERCENT}${SCREENTITLE}" + # RPROMPT="%(?..:()% ${PERCENT}${SCREENTITLE}" + RPROMPT="${PERCENT}${SCREENTITLE}" else - RPROMPT="%(?..:()% ${SCREENTITLE}" + # RPROMPT="%(?..:()% ${SCREENTITLE}" + RPROMPT="${SCREENTITLE}" fi # adjust title of xterm # see http://www.faqs.org/docs/Linux-mini/Xterm-Title.html @@ -326,13 +339,24 @@ fi esac } +# set colors + if autoload colors && colors 2>/dev/null ; then + BLUE="%{${fg[blue]}%}" + RED="%{${fg_bold[red]}%}" + GREEN="%{${fg[green]}%}" + CYAN="%{${fg[cyan]}%}" + WHITE="%{${fg[white]}%}" + NO_COLOUR="%{${reset_color}%}" + else + BLUE="%{%}" + RED="%{%}" + GREEN="%{%}" + CYAN="%{%}" + WHITE="%{%}" + NO_COLOUR="%{%}" + fi + EXITCODE="%(?..%?%1v )" - local BLUE="%{%}" - local RED="%{%}" - local GREEN="%{%}" - local CYAN="%{%}" - local WHITE="%{%}" - local NO_COLOUR="%{%}" PS2='`%_> ' # secondary prompt, printed when the shell needs more information to complete a command. PS3='?# ' # selection prompt used within a select loop. PS4='+%N:%i:%_> ' # the execution trace prompt (setopt xtrace). default: '+%N:%i>' @@ -422,9 +446,13 @@ zsh-help - hints for use of zsh on grml 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 @@ -463,14 +491,15 @@ Enjoy your grml system with the zsh!$reset_color" # 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' isgrmlcd && alias su="sudo su" # change to user root alias tlog="tail -f /var/log/syslog" # take a look at the syslog @@ -642,8 +671,7 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"." 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 } # }}} @@ -677,8 +705,8 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"." setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" } # csh compatibility freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done } manzsh() { /usr/bin/man zshall | vim -c "se ft=man| se hlsearch" +/"$1" - ; } +# manzsh() { /usr/bin/man zshall | most +/"$1" ; } # manzsh() { man zshall | $MYLESS -p $1 ; } -# manzsh() { /usr/bin/man zshall | most +/"$1" ; } # use "dchange " to view Debian's changelog of the package: dchange() { @@ -723,13 +751,16 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"." # use it e.g. via 'Restart apache2' if [ -d /etc/init.d ] ; then for i in Start Restart Stop Reload ; do - eval "$i() { $SUDO /etc/init.d/\$1 ${i:l} $2 ; }" + 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 fi # }}} +# make sure our environment is clean regarding colors + for color in BLUE RED GREEN CYAN WHITE ; unset $color + # source another config file if present {{{ if [ -r /etc/zsh/zshrc.local ]; then source /etc/zsh/zshrc.local