From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11192 invoked by alias); 23 Dec 2011 20:45:53 -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: 16665 Received: (qmail 20156 invoked from network); 23 Dec 2011 20:45:41 -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 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <111223124522.ZM17185@torch.brasslantern.com> Date: Fri, 23 Dec 2011 12:45:22 -0800 In-reply-to: <20111222230108.GA32237@miek.nl> Comments: In reply to Miek Gieben "Re: default to file completion" (Dec 23, 12:01am) References: <20111218101116.GA4446@miek.nl> <20111222230108.GA32237@miek.nl> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Miek Gieben , zsh-users@zsh.org Subject: Re: default to file completion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Dec 23, 12:01am, Miek Gieben wrote: } } > > ./scan -zone } > > } > > And nothing gets completed. How can I tell zsh to fallback to filename } > > completion at that point? } > } > "scan" is a command that already has completion in zsh } } Is there a way to disable the default completion for the } command 'scan' if you start it with './' ? You can intercept completion pretty early on by providing a compdef for the special context "-first-". -first- This is tried before any other completion function. The function called may set the _compskip parameter to one of various values: all: no further completion is attempted; a string containing the substring patterns: no pattern completion functions will be called; a string containing default: the function for the `-default-' context will not be called, but functions defined for commands will [be] Although it's not documented in the man pages, this can also be done by redefining the function _first (which by default is a no-op). Hence: _first() { if [[ CURRENT -gt 1 && "${words[1]}" = ./* ]]; then _compskip=all _files fi } There's a much more complicated example as a large comment in the _first function that is supplied with the shell.