From owner-freebsd-questions Sat Sep 23 17:27:10 2000 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id CDCDA37B424 for ; Sat, 23 Sep 2000 17:27:03 -0700 (PDT) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=root) by scientia.demon.co.uk with esmtp (Exim 3.16 #1) id 13cyHZ-000Pb8-00; Sun, 24 Sep 2000 00:00:33 +0100 Received: (from ben@localhost) by strontium.scientia.demon.co.uk (8.9.3/8.9.3) id AAA23510; Sun, 24 Sep 2000 00:00:33 +0100 (BST) (envelope-from ben) Date: Sun, 24 Sep 2000 00:00:33 +0100 From: Ben Smithurst To: Sean-Paul Rees Cc: questions@freebsd.org Subject: Re: zsh completion for /var/db/pkg Message-ID: <20000924000033.A30774@strontium.scientia.demon.co.uk> References: <20000923150435.A98968@seanrees.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20000923150435.A98968@seanrees.com> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Sean-Paul Rees wrote: > Also, does someone have a completion for the man pages? I think there's something do with pkg_* in the latest zsh ports, but I could be mistaken. Hmm, it seems to be in zsh-devel, but not zsh. Take a look anyway. I made this for manpages, but it's _really_ ugly and slow. It also doesn't work sometimes, but I don't care enough to have bothered fixing it. It's better than nothing anyway. function find_manpage() { start=$1 choices="" count=0 # need a colon in IFS to split $MANPATH old_IFS="$IFS" IFS=":$IFS" # need this to prevent error from "no match found" setopt nullglob for i in ${=MANPATH}; do for j in $i/*/${start}*; do # strip off leading path and trailing .n.gz choices="$choices ${${j##*/}%%.?.gz}" let "count = count + 1" if [[ $count -ge 100 ]]; then break 2 fi done done # turn off again unsetopt nullglob # put IFS back to what it was before IFS="$old_IFS" unset old_IFS # set the reply array eval reply=($choices) # clean up variables unset choices start count } compctl -K find_manpage man -- Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message