Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
completing and hiding some prefixes
- X-seq: zsh-users 17913
- From: Daniel <quite@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: completing and hiding some prefixes
- Date: Wed, 7 Aug 2013 20:14:25 +0000 (UTC)
- 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
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
I tried a few options of compadd, like -p, but it seems I would need to
write a separate function.
It would perhaps be interesting to have something more general, which
can complete for commands on the same pattern, but different
suffix/prefixes.
This is my naive attempt:
#compdef fofa
local cachedir
cachedir=~/foo/
#setopt extendedglob
_arguments '1:foo-cache:_files -W $cachedir -g "fa_*"'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author