From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6916 invoked by alias); 7 Aug 2013 20:33:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17913 Received: (qmail 14936 invoked from network); 7 Aug 2013 20:32:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at m.gmane.org designates 80.91.229.3 as permitted sender) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Daniel Subject: completing and hiding some prefixes Date: Wed, 7 Aug 2013 20:14:25 +0000 (UTC) Message-ID: X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c83-249-23-194.bredband.comhem.se User-Agent: slrn/1.0.1 (Linux) 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_*"'