From: "Jérémie Roquet" <jroquet@arkanosis.net>
To: TJ Luoma <luomat@gmail.com>
Cc: Zsh MailingList <zsh-users@zsh.org>
Subject: Re: completion for function arguments?
Date: Thu, 8 Aug 2019 15:49:52 +0200 [thread overview]
Message-ID: <CAFOazAM-Md+1QFyYSgEeoGCFgz5_-nD40s_01f28vDdhSQfL0A@mail.gmail.com> (raw)
In-Reply-To: <CADjGqHu2c=s8wk_wkrMEX4OdJOtWTNuCDnBynXgESYhjBiNdBQ@mail.gmail.com>
Le jeu. 8 août 2019 à 15:08, TJ Luoma <luomat@gmail.com> a écrit :
> Let me start by saying that I don't understand completion at all,
So, let's start by saying that I don't understand them much either,
and that someone will probably suggest something much simpler using
zstyle.
> I have a function called 'jump' which I will include below.
> The function takes one (1) argument from a specific list of arguments.
The following should work:
_jump() {
local targets=(macbook imac tyrion)
_wanted jump_target expl 'Jump target' compadd -a targets
}
compdef _jump jump
Note that you can achieve the same effect by just putting the
following in a file named _jump somewhere in your $fpath:
#compdef jump
local targets=(macbook imac tyrion)
_wanted jump_target expl 'Jump target' compadd -a targets
As I said, it should work, but there are probably much nicer ways to
achieve the same result.
Best regards,
--
Jérémie
next prev parent reply other threads:[~2019-08-08 13:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 13:06 TJ Luoma
2019-08-08 13:49 ` Jérémie Roquet [this message]
2019-08-08 15:42 ` Mikael Magnusson
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=CAFOazAM-Md+1QFyYSgEeoGCFgz5_-nD40s_01f28vDdhSQfL0A@mail.gmail.com \
--to=jroquet@arkanosis.net \
--cc=luomat@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).