X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=455aff9bd7ad753d9d0722332067d5a0537003ff;hb=822072725593e64b7dc57ba070433cb6112981d8;hp=9f306ac551a1b96f07ef7d789e5e1fd4d5efc76b;hpb=7c1c1fa428f3a7516668ea4fa707c356a758ca9d;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 9f306ac..455aff9 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: Son Okt 15 23:20:08 CEST 2006 [mika] +# Latest change: Sam Okt 21 16:20:30 CEST 2006 [mika] ################################################################################ # This file is sourced only for interactive shells. It # should contain commands to set up aliases, functions, @@ -132,15 +132,23 @@ fi # 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" ] ; then + autoload -U url-quote-magic && zle -N self-insert url-quote-magic + else + print 'Notice: no url-quote-magic available :(' fi alias run-help >&/dev/null && unalias run-help autoload run-help # use via 'esc-h' - is4 && autoload -U compinit && compinit # completition system +# completion system + is42 && if autoload -U compinit && [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Completion/compinit" ] ; then + compinit + else + print 'Notice: no compinit available :(' + function zstyle { } + function compdef { } + fi is4 && autoload -U zed # use ZLE editor to edit a file or function is4 && zmodload -i zsh/complist @@ -272,7 +280,11 @@ fi # }}} # {{{ set prompt - autoload promptinit ; promptinit # people should be able to use their favourite prompt + if [ -f "/usr/share/zsh/$ZSH_VERSION/functions/Prompts/promptinit" ] ; then + autoload promptinit && promptinit # people should be able to use their favourite prompt + else + print 'Notice: no prompiinit 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 @@ -566,6 +578,17 @@ grmlcomp() { # zstyle ':completion:*' completer _complete _correct _approximate # zstyle ':completion:*' expand prefix suffix +# automatic rehash? Credits go to Frank Terbeck +# function my_accept () { +# local buf +# [[ -z ${BUFFER} ]] && zle accept-line && return +# buf=( ${(z)BUFFER} ) +# [[ -z ${commands[${buf[1]}]} ]] && rehash +# zle accept-line +# } +# zle -N my_accept +# bindkey "^M" my_accept + # command for process lists, the local web server details and host completion hosts=(`hostname` grml.org) zstyle '*' hosts $hosts @@ -660,12 +683,30 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"." # manzsh() { /usr/bin/man zshall | most +/"$1" ; } # use "dchange " to view Debian's changelog of the package: - dchange() { most /usr/share/doc/${1}/changelog.Debian.gz ; } + dchange() { + if [ -r /usr/share/doc/${1}/changelog.Debian.gz ] ; then + most /usr/share/doc/${1}/changelog.Debian.gz + else + if [ -r /usr/share/doc/${1}/changelog.gz ] ; then + most /usr/share/doc/${1}/changelog.gz + else + echo "No changelog for package $1 found, sorry." + return 1 + fi + fi + } _dchange() { _files -W /usr/share/doc -/ } compdef _dchange dchange # use "uchange " to view upstream's changelog of the package: - uchange() { most /usr/share/doc/${1}/changelog.gz ; } + uchange() { + if [ -r /usr/share/doc/${1}/changelog.gz ] ; then + most /usr/share/doc/${1}/changelog.gz + else + echo "No changelog for package $1 found, sorry." + return 1 + fi + } _uchange() { _files -W /usr/share/doc -/ } compdef _uchange uchange