From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8111 invoked by alias); 14 Aug 2011 21:09:55 -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: 16221 Received: (qmail 27965 invoked from network); 14 Aug 2011 21:09:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=7msppM7SnCXS+tmsJOqxXxr5wl1+6DweOYPLEEYgDfs=; b=D1KFxMytyoOO4anoIXameNolP5oPC5HdqmlWO5gLtcmVZyCLNy/Nq5pqMu4er3bkQQ PnD5jh/0P9mMlDLpWrPvoCJDPRe+sF98zRXiEpIJ42dsJ91CNx+Eu4LJxGXvYg0PbrpG bzloeKuYYLu+T7ePqZI5204Ldy+Jhd+MELH34= MIME-Version: 1.0 In-Reply-To: <20110814205936.GI20653@prunille.vinc17.org> References: <20110814205936.GI20653@prunille.vinc17.org> Date: Sun, 14 Aug 2011 23:09:37 +0200 Message-ID: Subject: Re: command completion From: Mikael Magnusson To: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 14 August 2011 22:59, Vincent Lefevre wrote: > I asked a question several years ago about command/function/etc. > completion, but never had an answer. I'd like command completion > to be preferred over directory completion. > > For instance, if I create an executable file blah-cmd and a directory > blah-dir in the current directory ("." being in the $PATH), and do: > > % rehash > % zstyle ':completion:*:complete:-command-:*' tag-order 'commands' > % bl[TAB] > > then I can see that various commands are proposed, but not blah-cmd. > > ^Xh (_complete_help) at this point outputs: > > tags in context :completion::complete:-command-:: > =C2=A0 =C2=A0commands executables builtins functions aliases suffix-alias= es reserved-words jobs parameters =C2=A0(_alternative _command_names _autoc= d (eval)) > =C2=A0 =C2=A0commands =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (_path_commands _alternative _command_names= _autocd (eval)) > =C2=A0 =C2=A0jobs =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (_jobs _alternative _command_names _= autocd (eval)) > =C2=A0 =C2=A0parameters =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (_parameters _alternative _command_names _autocd (= eval)) > > Unfortunately not all the tags are described in the zshcompsys > man page, and the description is quite short, so that I don't > understand why blah-cmd hasn't been proposed. > > Then I've tried: > > % zstyle ':completion:*:complete:-command-:*' tag-order 'executables' > > but then both blah-cmd and blah-dir/ are proposed. > > Now, if I move blah-cmd somewhere else in $PATH, and use > > % zstyle ':completion:*:complete:-command-:*' tag-order 'commands' > % blah[TAB] > > then only blah-cmd is proposed, as expected. However if I do: > > % mkdir ~/blah-hdir > % cdpath=3D(. ~) > % setopt AUTO_CD > % blah[TAB] > > then both blah-cmd and blah-hdir/ are proposed. I don't see why > blah-hdir/ should be regarded as a command. Because it might contain executable files? What happens when you only create the dir and don't do the other things? --=20 Mikael Magnusson