zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: David Bustos <bustos@its.caltech.edu>, zsh-users@sunsite.auc.dk
Subject: Re: Menu-completion for particular commands
Date: Mon, 29 May 2000 00:12:58 +0000	[thread overview]
Message-ID: <1000529001258.ZM28486@candle.brasslantern.com> (raw)
In-Reply-To: <20000528154750.A2967@alex.caltech.edu>

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 <C-x h>
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   


  reply	other threads:[~2000-05-29  0:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-28 22:47 David Bustos
2000-05-29  0:12 ` Bart Schaefer [this message]
2000-05-29  1:48   ` David Bustos
2000-05-29  2:42     ` Bart Schaefer
2000-05-29  8:35 Sven Wischnowsky
2000-05-29 10:04 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1000529001258.ZM28486@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=bustos@its.caltech.edu \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).