Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: autocomplete in program
- X-seq: zsh-users 23081
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: autocomplete in program
- Date: Mon, 8 Jan 2018 16:40:45 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=IXpN9f79+MKbRKf1FpxF302XNqHbBGFDNf2tSsM0oKw=; b=t+lGf0O67qIOI3FeNHI6mtFPvFlPwG5vrt0IzPX5xuP4hafy3TYl2uQ3gl5v4u1gM2 MkZ4HLyB5ym8daoICu5PLRBlwIJCZC9mbqFIwHgYzd0otN/t5yfqhNdX6Zp7O8yX9Yfe fC2/fNJvwA3HdjT6fpGAqB1n/i1u3aykw6xqYTbaFEcFdaCuT74fYetLP1mF053QpLQP aEgGmCxznOVkOF/fO6HCTiFxvUKU8R5BaujqOTvmFifPNlPMz20tc38a2bgWyK/Y0rrz gULWHqN/w6Q4ZEHKO8AjHRa0wbqeUZCPmsZ6X3xCh6Jba3I1HNEdOtywyrQxwe5EbQew MtXA==
- In-reply-to: <86k1wrrhza.fsf@zoho.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: <86shbfrjla.fsf@zoho.com> <86k1wrrhza.fsf@zoho.com>
On Mon, Jan 8, 2018 at 4:30 PM, Emanuel Berg <moasen@xxxxxxxx> wrote:
>
>> If I send an incomplete filename to
>> a function, and then do the [[ -f $file ]]
>> test to determine if it is a file, and if it
>> isn't, can I programmatically do the
>> equivalent of interactive TAB, and if this
>> yields and unambiguous filename, use
>> that instead?
>
> I got help on #zsh on irc.freenode.net:
>
> matches=( ${file}*(N) )
>
You can also use approximate matching:
setopt extendedglob
matches=( (#a3)${file}(N) )
Here 3 means up to 3 characters in $file may be wrong or missing.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author