Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completing and hiding some prefixes



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