Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: matching commands by pattern



Frank Terbeck wrote:
> I'm trying to be able to use compsys to find all completions, that are
> possible as the first word of the command-line _and_ match a given
> pattern. Ideally, these matches should be accessible via a completion
> menu.

It's easy: just set the option "globcomplete", that's what it's designed
for.  This makes pattern characters active during normal completion, so
you don't have to do anything else special to get command completion in
command position.

You need to ensure the *'s aren't being grabbed by non-compsys expansion
but that's probably already the case.  If there were files in your
directory matching the pattern and you had the _expand completer before
_complete then it would still try to do globbing first.

> Is there a possibility, to get this going with 'expand-or-complete'
> instead of 'menu-complete'? That way you could use <TAB> to trigger
> the menu. I think this could be done by not expanding filenames, if
> completing the first word in the command-line. But I'm not sure, how
> to achieve this.

Well, with globcomplete you should have the full range of completion
options, so autolist etc. etc. should work as normal.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



Messages sorted by: Reverse Date, Date, Thread, Author