From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6519 invoked from network); 9 Jan 2003 15:53:06 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 9 Jan 2003 15:53:06 -0000 Received: (qmail 20782 invoked by alias); 9 Jan 2003 15:52:49 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5658 Received: (qmail 20773 invoked from network); 9 Jan 2003 15:52:48 -0000 Date: Thu, 9 Jan 2003 16:06:46 +0000 From: Phil Pennock To: zsh-users@sunsite.dk Subject: Re: Completion of dirs confused over cursor position Message-ID: <20030109160645.GA22637@globnix.org> Mail-Followup-To: zsh-users@sunsite.dk References: <20030109145133.GA22171@globnix.org> <6134254DE87BD411908B00A0C99B044F03A0B5CE@MOWD019A> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6134254DE87BD411908B00A0C99B044F03A0B5CE@MOWD019A> Organisation: Demon Internet Netherlands On 2003-01-09 at 18:02 +0300, Borzenkov Andrey wrote: > function _foo { > _files -W /some/directory > } > compadd _foo commandname > > does it work? No: compadd: can only be called from completion function However, that's looking much simpler than anything in the manual pages or the examples I looked at in the distributed completions. :^) I was getting lost in functions calling functions calling functions maintaining various levels of state, with reference man-pages and no tutorial. Is there a tutorial somewhere which I've missed? The manual pages are some of the most daunting I've seen. I do read manual-pages, but looking at these I can't get a mental handle on the frameword and what fits where, to get started. > And doing it automatically: > > echo > ~/functions/_foo << EOF > #compadd commandname > _files -W /some/directory > EOF That general structure I had (although I suspect that you meant cat, since echo doesn't use its stdin). And the supplied versions use "#compdef". If I use "#compadd", it's not auto-loaded. > fpath=($fpath ~/functions) > compinit And that I had. > the last part obviously goes into .zshrc or whatever. Try running > compinstall as well. Yup, tried that. Okay, logging in again, forcing a rebuild of .zcompdump (after changing to "#compdef", it now works. :^) Thanks, -Phil