zsh-users
 help / color / mirror / code / Atom feed
From: "Jesper Nygårds" <jesper.nygards@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Three questions about a completer
Date: Tue, 13 Sep 2016 18:16:13 +0200	[thread overview]
Message-ID: <CABZhJg_kVjB4Wb1FH2xb7=dB8wU4pLLa8H7Jf4+p-Mahjv3wPA@mail.gmail.com> (raw)
In-Reply-To: <75335.1473713583@hydra.kiddle.eu>

[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]

On Mon, Sep 12, 2016 at 10:53 PM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:

> Jesper Nygårds wrote:
> >Again, I want to put a string on the command line, hit
> > alt-e, and only those files having a part matching what i wrote should be
> > offered. If I then reverse the order, I want the same list, i.e. those
> > files matching what I originally wrote.
>
> Using _menu generally does what I think you're describing. To use that,
> you may want to use _generic instead of _list-result directly. I'd
> recommend using _generic regardless of whether you want _menu, actually.
> Other completers such as _match could also be useful.
>
>   zle -C list-comp menu-complete _generic
>   zstyle ':completion:*list-comp::::' completer _menu _list-result
>
>
Perhaps I am missing something obvious, but I cannot get this to work. I
tried applying your suggestions, and ended up with this:

_list-result() {
    print In _list-result
    local -a hlist=($HOME/*)
    compadd -n -V list_result -M 'l:|=* m:{[:lower:]}={[:upper:]}' -- $hlist
}

zle -C list-comp menu-complete _generic
zle -C rev-list-comp reverse-menu-complete _generic
zstyle ':completion:*list-comp::::' completer _menu _list-result
bindkey '\ee' list-comp
bindkey '\eE' rev-list-comp

However, something is missing, because completion is not  triggered. In
fact, the debugging line "In _list-result" is not printed, so _list-result
is never called. I assume there is something more that I need to put in
place that I have missed?

  reply	other threads:[~2016-09-13 16:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 11:38 Jesper Nygårds
2016-09-12 20:53 ` Oliver Kiddle
2016-09-13 16:16   ` Jesper Nygårds [this message]
2016-09-13 19:18     ` Jesper Nygårds
2016-09-14  2:59       ` Bart Schaefer
2016-09-14  7:22         ` Jesper Nygårds
2016-09-14 16:39           ` Bart Schaefer
2016-09-14 20:32             ` Jesper Nygårds
2016-09-15  4:49               ` Bart Schaefer
2016-09-15  6:01               ` Jesper Nygårds

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='CABZhJg_kVjB4Wb1FH2xb7=dB8wU4pLLa8H7Jf4+p-Mahjv3wPA@mail.gmail.com' \
    --to=jesper.nygards@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).