X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=06523f6f690c21120e164f4310458ad039b0b404;hb=81d9fc2095becd2f56beac52989807b55936f815;hp=69642103e4c10ce88ebe568ed04823154a558ebe;hpb=fab8bcc2d42a8202856a8ff1e1b5b21c596c51f8;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 6964210..06523f6 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -332,14 +332,20 @@ fi # GRML_WARN_SKEL # this function checks if a command exists and returns either true # or false. This avoids using 'which' and 'whence', which will # avoid problems with aliases for which on certain weird systems. :-) +# Usage: check_com [-c|-g] word +# -c only checks for external commands +# -g does the usual tests and also checks for global aliases check_com() { - local -i comonly + local -i comonly gatoo if [[ ${1} == '-c' ]] ; then (( comonly = 1 )) shift + elif [[ ${1} == '-g' ]] ; then + (( gatoo = 1 )) else (( comonly = 0 )) + (( gatoo = 0 )) fi if (( ${#argv} != 1 )) ; then @@ -360,6 +366,10 @@ check_com() { return 0 fi + if (( gatoo > 0 )) && [[ -n ${galiases[$1]} ]] ; then + return 0 + fi + return 1 } @@ -2613,7 +2623,8 @@ 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 tail head feh cp mv df stow uname ipacsum fetchipac; do + for compcom in cp deborphan df feh fetchipac head hnb ipacsum mv \ + pal stow tail uname ; do [[ -z ${_comps[$compcom]} ]] && compdef _gnu_generic ${compcom} done; unset compcom