Zsh Mailing List Archive
Messages sorted by:
Re: site-function for completion from specific directory
- X-seq: zsh-users 19035
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: site-function for completion from specific directory
- Date: Tue, 26 Aug 2014 14:46:51 +0100
- In-reply-to: <email@example.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <firstname.lastname@example.org>
On Tue, 26 Aug 2014 15:00:24 +0200
Eric Smith <es@xxxxxxxxxxxx> wrote:
> Oh zshellers,
> This is my use case.
> I want to complete the following command;
> mutt -f [foo]<tab>
> so that it expands nothing or the string `foo' as if they were
> ~/Mail/<tab> or ~/Mail/foo<tab>
> How would I write a compdef site-function for this and also
> ideally for my shell function wrapper around `mutt -f'?
If I've understood the basics of what you're trying to do --- check for
mailboxes in your mail directory and complete the bare name, removing
the common directory part --- then this completion should already work.
However, it looks like the function that handles this, _mailboxes from
Completion/Unix/Type/_mailboxes, makes some assumptions about where to
get the values for your mutt configuration. Try using ^X? to get some
output and work out which paths it's taking through the function. My
reading of the code (which I'm just looking at for the first time, at
least that I can remember, I expect I glanced at it years ago) is it
should pick the directories in the code following line 152 of that file.
You'll need to trace back where those variables come from if this isn't
I haven't worked out when you'd want it to complete nothing, and if the
square brackets are somehow crucial to the completion then I'm missing
the point entirely.
Messages sorted by: