From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20172 invoked by alias); 16 Mar 2014 19:28:02 -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: 18614 Received: (qmail 2091 invoked from network); 16 Mar 2014 19:27:46 -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 autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140316122727.ZM11132@torch.brasslantern.com> Date: Sun, 16 Mar 2014 12:27:27 -0700 In-reply-to: Comments: In reply to Eric Smith "Re: implementing a control for completing filenames with a defined list of tokens" (Mar 16, 3:13pm) References: <20131202142614.GA27697@trustfood.org> <131202075840.ZM3182@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: implementing a control for completing filenames with a defined list of tokens MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Mar 16, 3:13pm, Eric Smith wrote: } } I want to use this completion facility at the start of file (a } dir) names and also *in the middle* of the name. } So the tags may appear anywhere in the filename. } So I could type foobar__^K } for example and the function will complete with my tokens which all } begin with a double underscore. Hmm, that's a somewhat different question, and the answer depends on whether you want to complete existing directory names (limit the result to those that match your tokens) or whether you are trying to construct new names from the input line plus the tokens. Limiting to existing names is quite a bit easier; instead of defining a completer for the token-completion generic widget, we just define a file-patterns style: zle -C token-completion complete-word _generic bindkey ^K token-completion zstyle -e ':completion:token-completion:*' file-patterns \ 'reply=( "*(${(j:|:)${(qf)"$(