Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completing and hiding some prefixes
- X-seq: zsh-users 17914
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: completing and hiding some prefixes
- Date: Thu, 8 Aug 2013 20:16:09 +0100
- In-reply-to: <ktu9r0$q7l$1@ger.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <ktu9r0$q7l$1@ger.gmane.org>
On Wed, 7 Aug 2013 20:14:25 +0000 (UTC)
Daniel <quite@xxxxxxxx> wrote:
> I have files in ~/foo/. Among them, some are named: fa_abc fa_frog
> fa_gag. I want to write completion for a command "fofa", which completes
> among these particular files, but omitting the "fa_" prefix. Thus:
>
> $ fofa [TAB]
> $ fofa abc[TAB]
> $ fofa frog
You need something like this.
pws
#fofa
local cachedir=~/foo expl
local -a files
files=($cachedir/fa_*(:t))
files=(${files##fa_})
_wanted foo-cache expl 'foo cache' compadd -a files
Messages sorted by:
Reverse Date,
Date,
Thread,
Author