From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4865 invoked from network); 7 Jun 2000 05:27:18 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Jun 2000 05:27:18 -0000 Received: (qmail 6471 invoked by alias); 7 Jun 2000 05:26:59 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3119 Received: (qmail 6463 invoked from network); 7 Jun 2000 05:26:57 -0000 From: "Bart Schaefer" Message-Id: <1000607052651.ZM4901@candle.brasslantern.com> Date: Wed, 7 Jun 2000 05:26:51 +0000 In-Reply-To: Comments: In reply to Wayne Davison "configuring the new completion system" (Jun 6, 3:22pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.auc.dk Subject: Re: configuring the new completion system MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 6, 3:22pm, Wayne Davison wrote: } Subject: configuring the new completion system } } On Tue, 6 Jun 2000, Bart Schaefer wrote: } > As a workaround, the following should behave the way you want: } > } > bindkey '\t' complete-word } > autoload -U compinit } > compinit } > zstyle ':completion:*' completer _expand _complete } > zstyle ':completion:*:expand:::' glob 1 } > zstyle ':completion:*:expand:::' substitute 1 } } My biggest gripe is that if I type "~/.z" or "$HOME/.z" and press tab, } the prefix expands into my home directory path. I *hate* this. I'm } typing an abbreviated directory path and I want to complete an } abbreviated directory path. When I remove the "_expand" portion of } the zstyle, then that part of the completion works properly, but I can } no longer expand "~/.z*" into a list of file names. I think you want to NOT rebind '\t' to complete-word -- that is, leave it bound to expand-or-complete -- AND leave out the _expand completer. This will give you the old behavior of expansion followed by the new behavior of completion. You can still get the new behavior of _expand from in this case. You could also ignore the recommendation in the manual, and do this: bindkey '\t' expand-or-complete zstyle ':completion:*' completer _complete _expand This will first try old-style expansion, and then new-style completion, and finally (if nothing else has happened yet) new-style expansion. } On a related note, I've always disliked the fact that wildcard } expansion expands variables and tilde references. For instance, if I } type: } } touch ~/.tmp{1..3} } rm ~/.tmp* Unfortunately tilde-references are considered part of filename generation for purposes of _expand. Variables are another matter; that's what the `substitute' style is for. Set it to 0 instead of to 1, and parameter expressions (including $(...) etc.) will not be expanded. } I want to see: } } rm ~/.tmp1 ~/.tmp2 ~/.tmp3 What's amusing is that _expand behaved this way for a while, but somebody else complained that he wanted the tildes to expand like they do with expand-or-complete. However, there's also the `completions' style: zstyle ':completion:*:expand:*' completions 1 If you set that style and do zsh% rm ~/.tmp (note no `*') then you'll see what you wanted. I would not recommend using that with _expand in the completer style, though. (If you want to be able to have the `*' in there, you'll need to setopt globcomplete as well.) You could also set the style so that behaves that way ONLY if the current word begins with a tilde, like so: zstyle ':completion:*:expand:*' completions '${(M)#PREFIX#\~}' The tricky bit is backslashing the tilde there; I'm not sure why that's required. Anyway, the value of the completions style is evaluated in $[...] and if that returns nonzero then instead of expansion, it does completion, but inserts all possible completions. So the above says that if there's a substring that matches ~ at the front of the current word, then expand all completions, otherwise do expansion as usual. } Finally, one of the just-committed cvs changes has introduced a bug } where an extra space is getting added when it shouldn't be. Now, if } you type "~/.z" you get "/home/wayne/.z " even though that file } does not exist. You should be able to reproduce this as follows: } } % zsh -f } % autoload -U compinit } % compinit You should use "compinit -D" to test the real default behavior; without the -D it may load a .zcompdump that isn't up to date. } % zstyle ':completion:*' completer _expand _complete } % zstyle ':completion:*:expand:::' glob 1 } % ls ~/.z Hmm, you're right, it's one of the *really* recent ones, probably either 11777 or 11776 (I hope not 11768). I had to re-"make install" to see it. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net