From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21965 invoked by alias); 17 Sep 2014 15:51:58 -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: 19102 Received: (qmail 24820 invoked from network); 17 Sep 2014 15:51:56 -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: <140917085133.ZM6725@torch.brasslantern.com> Date: Wed, 17 Sep 2014 08:51:33 -0700 In-reply-to: <54194198.2010607@thregr.org> Comments: In reply to "Yuri D'Elia" "Re: rsync --progress stops completion" (Sep 17, 10:08am) References: <2002755.9ryFYYVtTN@note> <5418786F.8030001@thregr.org> <140916175124.ZM5742@torch.brasslantern.com> <54194198.2010607@thregr.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: rsync --progress stops completion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 17, 10:08am, Yuri D'Elia wrote: } } > (Wow, gmane sent Yuri's messaeg through with no To/Cc headers.) } } [I bcc'ed you] (Obviously, but a message with no To header at all is theoretically ill-formed, so I'm surprised gmane didn't mock up something.) } It happens to me from time to time, though I'm usually not motivated } enough to report it, that a command which is perfectly fine does not } perform file completion anymore, which is probably *the* most important } completer I care about. } } Is there a way to somehow get this as a general behavior, or it's } dependent on the specific command completion? Sure, just add _files to the end of your completer zstyle, e.g.: zstyle ':completion:*' completer _oldlist _expand _complete _files The completer style is tried in order until one of the named functions returns zero; completion only fails if all of the functions fail. With _files at the end, you'll always get default file completion when all else fails. You can get fancier; here's a (slightly crude) way to prompt for it: zstyle ':completion:*' completer _oldlist _expand _complete _maybe_files _maybe_files () { local q read -t 2 -q $'q?\nNo completions - try files? ' && _files || q=n zle -I [[ $q = y ]] } That could be extended e.g. to cache the names of commands for which the answer was yes and skip the prompt for those next time. (If you skip the prompt, also skip the "zle -I".) There are other tricks possible, e.g., to arrange that _files is called only if you hit tab twice, but I'm going to let somebody else work that solution out.