Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)



[ moved to -workers and CC'ed to Vincent ]

Vincent Lefevre wrote:

> On Tue, Jun 06, 2000 at 03:20:38 +0000, 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
> > 
> > If you have some customized compctl commands, you may also want:
> > 
> > zstyle ':completion:*' use-compctl 1
> 
> If I use this (at the end of my .zshrc), variable names completion
> doesn't work any longer. For instance, I type "echo $ZSH_V":
> 
> Et encore? echo $ZSH_V
> 
> then [TAB], and I get:
> 
> Et encore? echo #
>          $ZSH_V
> 
> where '#' represents the cursor.

The _expand completer offers you the expansion of $ZSH_V (an empty
string) and the original and enters menu-completion so that you can
toggle between the two (with the `expansion' being inserted in the
line immediately).

Hm, maybe we shouldn't use `empty' expansions.

And if I'm not completely mistaken, that test for add-space should eb
the other way round.

And to get nearer to the expand-or-complete behaviour, you should also 
use:

  zstyle ':completion:*:expand:*' tag-order all-expansions

That will make it insert only all the expansions in the line, not
allowing you to menu between the original string, the expansions
one-by-one and all expansions at once.

Bye
 Sven

Index: Completion/Core/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_expand,v
retrieving revision 1.13
diff -u -r1.13 _expand
--- Completion/Core/_expand	2000/05/31 09:38:26	1.13
+++ Completion/Core/_expand	2000/06/06 12:51:44
@@ -54,7 +54,7 @@
 
 # If the array is empty, store the original string again.
 
-(( $#exp )) || exp=("$word")
+[[ -z "$exp" ]] && exp=("$word")
 
 subd=("$exp[@]")
 
@@ -92,7 +92,7 @@
 if (( $#exp == 1 )); then
   if [[ -d $exp && "$exp[1]" != */ ]]; then
     suf=/
-  elif zstyle -T ":completion:${curcontext}:" add-space; then
+  elif ! zstyle -T ":completion:${curcontext}:" add-space; then
     suf=
   fi
 fi

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author