X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=50898ce106381e19add71c4be08e5285a559b65a;hb=4d08694c336e3e92a4afa1ade849490cf73b6fb8;hp=1d0f35747d46911c714d860f7e696f60769fe4d3;hpb=7fc9f757507ed26cbf09e8e168e266bdf7106f9b;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 1d0f357..50898ce 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -521,10 +521,6 @@ for var in LANG LC_ALL LC_MESSAGES ; do [[ -n ${(P)var} ]] && export $var done -xsource "/etc/sysconfig/keyboard" - -TZ=$(xcat /etc/timezone) - # set some variables if check_com -c vim ; then #v# @@ -605,8 +601,9 @@ if is4 ; then fi # completion system +COMPDUMPFILE=${COMPDUMPFILE:-${ZDOTDIR:-${HOME}}/.zcompdump} if zrcautoload compinit ; then - compinit || print 'Notice: no compinit available :(' + compinit -d ${COMPDUMPFILE} || print 'Notice: no compinit available :(' else print 'Notice: no compinit available :(' function compdef { } @@ -773,7 +770,7 @@ grmlcomp() { # use generic completion system for programs not yet defined; (_gnu_generic works # with commands that provide a --help option with "standard" gnu-like output.) - for compcom in cp deborphan df feh fetchipac head hnb ipacsum mv \ + for compcom in cp deborphan df feh fetchipac gpasswd head hnb ipacsum mv \ pal stow tail uname ; do [[ -z ${_comps[$compcom]} ]] && compdef _gnu_generic ${compcom} done; unset compcom @@ -1560,6 +1557,7 @@ if [[ -f ${DIRSTACKFILE} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then fi chpwd() { + if (( $DIRSTACKSIZE <= 0 )) || [[ -z $DIRSTACKFILE ]]; then return; fi local -ax my_stack my_stack=( ${PWD} ${dirstack} ) if is42 ; then @@ -2295,8 +2293,8 @@ fi # do we have GNU ls with color-support? if [[ "$TERM" != dumb ]]; then - #a1# List files with colors (\kbd{ls -b -CF \ldots}) - alias ls='ls -b -CF '${ls_options:+"${ls_options[*]}"} + #a1# List files with colors (\kbd{ls -CF \ldots}) + alias ls='ls -CF '${ls_options:+"${ls_options[*]}"} #a1# List all files, with colors (\kbd{ls -la \ldots}) alias la='ls -la '${ls_options:+"${ls_options[*]}"} #a1# List files with long colored list, without dotfiles (\kbd{ls -l \ldots}) @@ -2306,7 +2304,7 @@ if [[ "$TERM" != dumb ]]; then #a1# List files with long colored list, append qualifier to filenames (\kbd{ls -lF \ldots})\\&\quad(\kbd{/} for directories, \kbd{@} for symlinks ...) alias l='ls -lF '${ls_options:+"${ls_options[*]}"} else - alias ls='ls -b -CF' + alias ls='ls -CF' alias la='ls -la' alias ll='ls -l' alias lh='ls -hAl' @@ -2534,6 +2532,7 @@ compdef _functions freload #f1# List symlinks in detail (more detailed version of 'readlink -f' and 'whence -s') sll() { [[ -z "$1" ]] && printf 'Usage: %s \n' "$0" && return 1 + local file for file in "$@" ; do while [[ -h "$file" ]] ; do ls -l $file @@ -2546,26 +2545,31 @@ sll() { # PAGER='less -Mr' - If so, the use of $PAGER here needs fixing # with respect to wordsplitting. (ie. ${=PAGER}) if check_com -c $PAGER ; then - #f3# View Debian's changelog of a given package + #f3# View Debian's changelog of given package(s) dchange() { emulate -L zsh - if [[ -r /usr/share/doc/$1/changelog.Debian.gz ]] ; then - $PAGER /usr/share/doc/$1/changelog.Debian.gz - elif [[ -r /usr/share/doc/$1/changelog.gz ]] ; then - $PAGER /usr/share/doc/$1/changelog.gz - else - if check_com -c aptitude ; then - echo "No changelog for package $1 found, using aptitude to retrieve it." - if isgrml ; then - aptitude -t unstable changelog $1 + [[ -z "$1" ]] && printf 'Usage: %s \n' "$0" && return 1 + + local package + for package in "$@" ; do + if [[ -r /usr/share/doc/${package}/changelog.Debian.gz ]] ; then + $PAGER /usr/share/doc/${package}/changelog.Debian.gz + elif [[ -r /usr/share/doc/${package}/changelog.gz ]] ; then + $PAGER /usr/share/doc/${package}/changelog.gz + elif [[ -r /usr/share/doc/${package}/changelog ]] ; then + $PAGER /usr/share/doc/${package}/changelog + else + if check_com -c aptitude ; then + echo "No changelog for package $package found, using aptitude to retrieve it." + aptitude changelog "$package" + elif check_com -c apt-get ; then + echo "No changelog for package $package found, using apt-get to retrieve it." + apt-get changelog "$package" else - aptitude changelog $1 + echo "No changelog for package $package found, sorry." fi - else - echo "No changelog for package $1 found, sorry." - return 1 fi - fi + done } _dchange() { _files -W /usr/share/doc -/ } compdef _dchange dchange @@ -2751,11 +2755,6 @@ if check_com vim; then } fi -# make a backup of a file -bk() { - cp -a "$1" "${1}_$(date --iso-8601=seconds)" -} - ssl_hashes=( sha512 sha256 sha1 md5 ) for sh in ${ssl_hashes}; do @@ -2943,8 +2942,13 @@ modified() { check_com new || alias new=modified # use colors when GNU grep with color-support -#a2# Execute \kbd{grep -{}-color=auto} -(( $#grep_options > 0 )) && alias grep='grep '${grep_options:+"${grep_options[*]}"} +if (( $#grep_options > 0 )); then + o=${grep_options:+"${grep_options[*]}"} + #a2# Execute \kbd{grep -{}-color=auto} + alias grep='grep '$o + alias egrep='egrep '$o + unset o +fi # Translate DE<=>EN # 'translate' looks up fot a word in a file with language-to-language