zsh-users
 help / color / mirror / code / Atom feed
* blah*[TAB] (difference between 3.1.6 and 3.1.9)
@ 2000-06-06  1:07 Vincent Lefevre
  2000-06-06  3:20 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Lefevre @ 2000-06-06  1:07 UTC (permalink / raw)
  To: zsh-users

Consider a directory where there are two files blah1 and blah2. With
zsh 3.1.6, when I typed blah* followed by a tab, "blah1 blah2 " was
generated (with a space after blah2). With zsh 3.1.9, "blah1 blah2"
is generated (with *no* space after blah2).

How can I have the old behavior (much more logical IMHO)?

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Computer science / computer arithmetic / Arénaire project at LIP, ENS-Lyon


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
  2000-06-06  1:07 blah*[TAB] (difference between 3.1.6 and 3.1.9) Vincent Lefevre
@ 2000-06-06  3:20 ` Bart Schaefer
  2000-06-06  9:22   ` Vincent Lefevre
  2000-06-06 22:22   ` configuring the new completion system Wayne Davison
  0 siblings, 2 replies; 6+ messages in thread
From: Bart Schaefer @ 2000-06-06  3:20 UTC (permalink / raw)
  To: Vincent Lefevre, zsh-users

On Jun 6,  3:07am, Vincent Lefevre wrote:
} Subject: blah*[TAB] (difference between 3.1.6 and 3.1.9)
}
} Consider a directory where there are two files blah1 and blah2. With
} zsh 3.1.6, when I typed blah* followed by a tab, "blah1 blah2 " was
} generated (with a space after blah2). With zsh 3.1.9, "blah1 blah2"
} is generated (with *no* space after blah2).
} 
} How can I have the old behavior (much more logical IMHO)?

Something's definitely gone wrong with expand-or-complete.  This was not
intentional.

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

The above consititutes pretty much the minimal set of commands to emulate
the default behavior of expand-or-complete in 3.1.6 and earlier versions
while using the new completion system.

-- 
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   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: blah*[TAB] (difference between 3.1.6 and 3.1.9)
  2000-06-06  3:20 ` Bart Schaefer
@ 2000-06-06  9:22   ` Vincent Lefevre
  2000-06-06 22:22   ` configuring the new completion system Wayne Davison
  1 sibling, 0 replies; 6+ messages in thread
From: Vincent Lefevre @ 2000-06-06  9:22 UTC (permalink / raw)
  To: zsh-users

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.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Computer science / computer arithmetic / Arénaire project at LIP, ENS-Lyon


^ permalink raw reply	[flat|nested] 6+ messages in thread

* configuring the new completion system
  2000-06-06  3:20 ` Bart Schaefer
  2000-06-06  9:22   ` Vincent Lefevre
@ 2000-06-06 22:22   ` Wayne Davison
  2000-06-07  5:26     ` Bart Schaefer
  1 sibling, 1 reply; 6+ messages in thread
From: Wayne Davison @ 2000-06-06 22:22 UTC (permalink / raw)
  To: zsh-users

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

This comes close, but there's still something about this setup that
annoys the heck out of me.  (I'm only just beginning to try to get the
new completion system working (since I have mainly been using a
customized version of 3.0.7 until just recently), so hopefully this
can be tweaked.)

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 would love to
see a version of _expand that works like it did in 3.0.x.

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*<tab>

I want to see:

    rm ~/.tmp1 ~/.tmp2 ~/.tmp3

not:

    rm /home/wayne/.tmp1 /home/wayne/.tmp2 /home/wayne/.tmp3

I've always been meaning to look into fixing this.  I figure that the
code can either keep a copy of the unexpanded strings to substitute
into, or that it can do a set of reverse substitutions after the
wildcard expansion has completed (e.g. turning "/home/wayne" back into
a "~" at the tail end of the process).

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<tab>" 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
% zstyle ':completion:*' completer _expand _complete
% zstyle ':completion:*:expand:::' glob 1
% ls ~/.z<tab>

..wayne..


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: configuring the new completion system
  2000-06-06 22:22   ` configuring the new completion system Wayne Davison
@ 2000-06-07  5:26     ` Bart Schaefer
  2000-06-07  6:03       ` Wayne Davison
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2000-06-07  5:26 UTC (permalink / raw)
  To: zsh-users

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 <C-x e> 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*<tab>

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<C-x e>

(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 <C-x e> 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<tab>" 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<tab>

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   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: configuring the new completion system
  2000-06-07  5:26     ` Bart Schaefer
@ 2000-06-07  6:03       ` Wayne Davison
  0 siblings, 0 replies; 6+ messages in thread
From: Wayne Davison @ 2000-06-07  6:03 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Wed, 7 Jun 2000, Bart Schaefer wrote:
> 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.

That would be cool if I could get it to work.  However, no matter
what I try, tab does not expand wildcards with expand-or-complete
set.  It just expands $VARIABLES.

> You can still get the new behavior of _expand from <C-x e> in this case.

The only thing I get when I do that is this error:

    _expand_word:5: curcontext: parameter not set

This is caused by my predilection to having the "no_unset" option set
for my interactive-shell use.  Seems like this should get turned off
when the shell runs some completion/expansion code.  Do we have an
existing solution for such things?

When I "setopt unset", then the <C-x e> binding is quite handy.  If I
could just re-introduce those old changes to have it stop expanding
tildes, I'd be quite happy.

..wayne..


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-06-07  6:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-06  1:07 blah*[TAB] (difference between 3.1.6 and 3.1.9) Vincent Lefevre
2000-06-06  3:20 ` Bart Schaefer
2000-06-06  9:22   ` Vincent Lefevre
2000-06-06 22:22   ` configuring the new completion system Wayne Davison
2000-06-07  5:26     ` Bart Schaefer
2000-06-07  6:03       ` Wayne Davison

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).