Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion for function arguments?
- X-seq: zsh-users 24136
- From: Jérémie Roquet <jroquet@xxxxxxxxxxxxx>
- To: TJ Luoma <luomat@xxxxxxxxx>
- Subject: Re: completion for function arguments?
- Date: Thu, 8 Aug 2019 15:49:52 +0200
- Cc: Zsh MailingList <zsh-users@xxxxxxx>
- In-reply-to: <CADjGqHu2c=s8wk_wkrMEX4OdJOtWTNuCDnBynXgESYhjBiNdBQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADjGqHu2c=s8wk_wkrMEX4OdJOtWTNuCDnBynXgESYhjBiNdBQ@mail.gmail.com>
Le jeu. 8 août 2019 à 15:08, TJ Luoma <luomat@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author