From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23526 invoked by alias); 4 Feb 2014 15:39:44 -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: 18387 Received: (qmail 3343 invoked from network); 4 Feb 2014 15:39:28 -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: <140204073937.ZM21329@torch.brasslantern.com> Date: Tue, 04 Feb 2014 07:39:37 -0800 In-reply-to: Comments: In reply to "Keerthan jai.c" "How to make a function use inbuilt completions of another command?" (Feb 3, 11:09pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: How to make a function use inbuilt completions of another command? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 3, 11:09pm, Keerthan jai.c wrote: } } 'compdef __tmux-sessions funcname' works only if _tmux has been loaded by } triggering a tab completion on 'tmux' Ideally, the _tmux completer would offer to interpret the $service parameter and jump to the appropriate subsection. If that were done, you could write something similar to: compdef _tmux funcname=sessions Since that's not yet possible (few completion function writers know about the command=service extension), you're going to have to do something like this: _tmux 2>/dev/null # force _tmux to be loaded and define helpers compdef __tmux-sessions funcname It should be harmless to do this; after defining the helpers for all of its subcommands, _tmux will simply fail because it is not being called in completion context (hence 2>/dev/null to hide the warning).