From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20077 invoked by alias); 9 Jan 2013 04:40:37 -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: 17541 Received: (qmail 9252 invoked from network); 9 Jan 2013 04:40:33 -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: <130108204025.ZM4816@torch.brasslantern.com> Date: Tue, 08 Jan 2013 20:40:25 -0800 In-reply-to: Comments: In reply to Daniel "Re: completer that first expands global aliases (Re: dsf)" (Jan 8, 9:29pm) References: <1357650387.9070.YahooMailNeo@web171903.mail.ir2.yahoo.com> <20130108170145.GA4762@kelebek.lublin.se> <130108102404.ZM4596@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: completer that first expands global aliases (Re: dsf) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 8, 9:29pm, Daniel wrote: } Subject: Re: completer that first expands global aliases (Re: dsf) } } > zstyle -e ':completion:most-recent-*::::' completer \ } > 'compprefuncs=(_expand_alias) reply=(_menu _complete _match)' } } Ah, I understand how this is supposed to work; both your examples. Though, } neither of them does work. I have to press ^Xm twice, first to expand my DL, } and a second time to get a first file match. I think you're never going to get precisely the behavior you want, because aliases have to be entire words. For example, if without using completion at all you gave the command ls DL* the DL would not expand, so you would not see a listing of the files in the ~/dl/ directory. Completion is going to have the same issue; the alias has to expand as a word of its own before zsh can discover that it is a directory that can contain files to match. I think what you really want is a named directory, although you still have to type a leading tilde and trailing slash (e.g. ~DL/) to refer to files within one. With a named directory, completion should "just work" without having to first expand the abbreviation to the path to which it refers. % hash -d DL=~/dl % ls ~DL/ Of course if your directory is really named "dl" that's not saving you very much. If that won't do, then the way to get the closest to what you want is to write a widget that modifies the words array and updates $PREFIX before calling the _main_complete function. You may be able to do this by cribbing from _expand_alias.