From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6092 invoked from network); 29 May 2000 00:13:21 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 May 2000 00:13:21 -0000 Received: (qmail 1164 invoked by alias); 29 May 2000 00:13:09 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3085 Received: (qmail 1154 invoked from network); 29 May 2000 00:13:08 -0000 From: "Bart Schaefer" Message-Id: <1000529001258.ZM28486@candle.brasslantern.com> Date: Mon, 29 May 2000 00:12:58 +0000 In-Reply-To: <20000528154750.A2967@alex.caltech.edu> Comments: In reply to David Bustos "Menu-completion for particular commands" (May 28, 3:47pm) References: <20000528154750.A2967@alex.caltech.edu> X-Mailer: Z-Mail (5.0.0 30July97) To: David Bustos , zsh-users@sunsite.auc.dk Subject: Re: Menu-completion for particular commands MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 28, 3:47pm, David Bustos wrote: } Subject: Menu-completion for particular commands } } How do I get zsh to menu-complete arguments to vim and gvim, while leaving } normal completion for other commands alone? In 3.0.x, you can't, really; the closest you could come would be to use `setopt auto_menu' so that one tab does normal completion and two tabs starts menu completion. That affects all commands, though. In 3.1.6+, you can do it with the new completion system. (You're probably best off with at least 3.1.7-pre-4, or wait a few days for the real 3.1.7 release.) If you haven't already set up the completion system, do this: zsh% autoload -U compinstall zsh% compinstall This will lead you through a bunch of menus to configure the completion system. (If the above doesn't work, you've probably overwritten zsh's default value of $fpath; fix that in your ~/.zshrc or wherever and start again.) Once you have that ready, you can do this: zsh% vim tags in context :completion::complete:vim:: all-files (_files _default) That is, you type v i m space control-X h and the next two lines are what zsh prints back at you. These show you the name of the completion context for that position on that command line, and the set of tags that zsh uses to look up completion styles in that context. Next you look through the "Completion System Configuration" section of the doc to find something about menu completion. Lo and behold: menu If this is set to true in a given context, using any of the tags defined for a given completion, menu completion will be used. The tag `default' can be used to match any tag, but a specific tag will take precedence. [... a lot of other stuff ...] With these two pieces of information, you're ready to write a "zstyle" command: zsh% zstyle :completion::complete:vim::default menu true Presto, menu completion for vim. You could do a second similar command for gvim, but instead notice that it's possible to use glob patterns in any of the places between the colons in a context. So: zsh% zstyle ':completion::complete:(g|)vim::default' menu true The `(g|)' means to match a `g' or nothing. So there's your style to menu-complete the arguments of vim and gvim, leaving everything else alone. Put it in your .zshrc with all the other styles that compinstall added for you, and happy tabbing. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net