zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Ahmad Ismail <ismail783@gmail.com>, zsh-users@zsh.org
Subject: Re: how to use tags in zsh completion system
Date: Wed, 26 Aug 2020 11:57:22 +0100 (BST)	[thread overview]
Message-ID: <441849700.1433895.1598439442873@mail2.virginmedia.com> (raw)
In-Reply-To: <CAHAhJwJdcSYaftAkfOyv2v63LW-SdwV+34LZh0i-E3GUJzZv1g@mail.gmail.com>

> On 26 August 2020 at 09:59 Ahmad Ismail <ismail783@gmail.com> wrote:
> The [documentation][1] says
> 
> >     zstyle ':completion:*:aliens:*' tag-order \
> >       'frooble:-funny:funny\ frooble' frooble
> >which is used when you're completing for the command aliens, which
> presumably has completions tagged as `frooble' ...
> 
> I understand that both context and tag can be viewed using <kbd>^Xh</kbd>.
> So, I tried the following command but suggestion did not show the tags.
> 
>     % zstyle ':completion:*:aliens:*' tag-order 'frooble:-funny:funny\
> frooble' frooble
>     % aliens <kbd>TAB</kbd>
>     Completing file
>     Desktop/       Documents/     dotfiles/      Downloads/
>     % aliens <kbd>^Xh</kbd>
>     tags in context :completion::complete:aliens::
>         globbed-files  (_files _default)
>     % aliens frooble <kbd>^Xh</kbd>
>     tags in context :completion::complete:aliens::
>         globbed-files  (_files _default)
> 
> I think I am doing something wrong with
> 
> > completions tagged as `frooble'
> 
> Please help me understand how to use tags in zsh completion system.

Hi Ahmad,

That section in the guide is actually just an example of how things work
using an invented command --- your understanding is basically correct but
actually there is no "aliens" command.

Just off the top of my head (other people may have their own favourite
examples), one interesting command with a number of different tags
that apply at the start of completion is scp: ^xh for that gives me

tags in context :completion::complete:scp::
    argument-rest options  (_arguments _ssh _ssh)
tags in context :completion::complete:scp:argument-rest:
    files hosts users  (_ssh _ssh) 
    globbed-files      (_files _ssh _ssh) 
    hosts              (_hosts _combination _ssh_hosts _ssh _ssh) 
    users              (_users _combination _ssh_users _ssh _ssh)

so that might be something to play with.

(Alternatively, if I got my act together I could probably write
a fake completion for "aliens" that actually did what the guide
says...)

Cheers
pws


  reply	other threads:[~2020-08-26 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26  8:59 Ahmad Ismail
2020-08-26 10:57 ` Peter Stephenson [this message]
2020-08-26 11:28   ` Ahmad Ismail
2020-08-26 12:01     ` Peter Stephenson
2020-08-26 12:39       ` Ahmad Ismail
2020-09-04 19:23   ` Daniel Shahaf
2020-09-05 11:29     ` Ahmad Ismail

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=441849700.1433895.1598439442873@mail2.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=ismail783@gmail.com \
    --cc=zsh-users@zsh.org \
    /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).