zsh-users
 help / color / mirror / code / Atom feed
From: Borsenkow Andrej <Andrej.Borsenkow@mow.siemens.ru>
To: Will Yardley <william@hq.newdream.net>
Cc: zsh-users@sunsite.dk
Subject: Re: globbing
Date: Sat, 11 Aug 2001 15:10:49 +0400	[thread overview]
Message-ID: <3B7512B9.8010104@mow.siemens.ru> (raw)
In-Reply-To: <20010810123418.H4701@hq.newdream.net>

[Please, do not send private replies to public mails unless specifically 
asked. Besides, others may definitely be of more help here than me :-)]

Will Yardley wrote:
> Borsenkow Andrej wrote:
> 
>>>in bash if it hit % cd /home/* and hit tab, it just sits there (although
>>>i can tab complete other stuff)
>>>
> 
>>Can you be more precise? You want complete glob patterns but do not want to
>>see completion list? You do not want to see completion listing always or
>>only in case of completing patterns?
>>
> 
> i don't want to tab complete them at all in that particular case... ie i'd
> like to expand individual filenames but i'd like it to just act like bash and
> sit there when i type cd /home/*<tab> or whatever.  i may be explaining
> myself wrong which might be resulting in some confusion, but that's the best
> way i know how to explain it.  i still want the * to represent a wildcard; i
> just don't want to see a list of 5 billion files at once, and if i type:
> mv ju*<tab> 
> i don't want to have the command line turn into:
> mv junk1 junk2 junk2
> 
> i wouldn't even mind having something like auto_list or bash_auto_list for
> it; i just don't want all possible matches for * to show up on the command
> line.  if i accidentally type tab when trying to do /home/*/something it's
> very annoying to have the whole command line fill up with every possible
> match.  this has happened to me on a number of occasions.
> 
> is there an old skool way to do this? i will brave the new styles if i must
> but i am still a bit fearful.  i know 4.02 is faster than 4.01 with that, but
> a lot of my machines for work are much older versions of zsh.
> 

Of course. Use complete-word instead of expand-or-complete:

bindkey '^I' complete-word

It will totally ignore any patterns and try to complete "as is". But 
note that new completion gives you choices between completion, matching 
and expansion and you can select the order in whch it happens and and 
and ...

> 
>>But I realized that listing is not controlled by style. How weird.
>>Actually, according to documentation, the
>>
>>zstyle ':completion::match:*' menu off
>>must work but does not.
>>
>  
> yeah that doesn't work either.
> 
> 
>>>i think the second question has been brought up before, but is there a
>>>way to do: % cd /usr/l<tab>bin and have that complete to /usr/local/bin
>>>as in bash (without putting a space after /usr?  i do have
>>>complete_in_word set, but that's not exactly the same thing...
>>>
>  
> 
>>Why do you want to do it "bash style" with zsh? E.g. using zsh it is much
>>better to do
>
>>ls /u/l/bTA
> 
> that is cool but not at all what i was trying to accomplish...
> the whole reason i'm changing it in the middle of the word is because
> i made a mistake.  ie
> 
> cd /usr/bi (ooops)
> cd /usr/l<tab>/bi
> 
> in bash this expands to /usr/local/bin - without putting a space befure /bin

If it is the sole reason to use prefix completion - my example does it 
as well. It does better job than bash - it checks suffix as well and 
won't try to complete prefix if the whole completion would fail. Wit zsh 
you can do:

cd /u/bTAB
It completes to /usr/bin - you realise you made a mistake. Press Undo 
(^_ or ^Xu by default). You get inital line. Go back, add `l/' like in

cd /u/l/TABb

and it will be completed to /usr/local/bin. But *only* if /usr/local/bin 
exists. And it will move cursor to the end if you have the single choice 
or to the first ambiguous place if you have multiple choices. And this 
is configurable as well :-)

> in zsh i can only expand it if i put a space, and then the result looks like:
> aura% cd /usr/local/ bin/
> 
> complete_in_word doesn't do this (as was mentioned the last time someone
> brought this up on the list).  i find the bash way much more intuitive even
> if the zsh way is more 'correct'.
> 

You have to use expand-or-complete-prefix instead of expand-or-complete 
(or complete-word), like

bindkey '^I' expand-or-complete-prefix
setopt completeinword

But then your first problem is back - there is no complete-prefix widget.
  It is unlikely that any will be added - new completion can do 
everything you want and with much better configuration possibilities. 
(modulo bugs, as looks there are with menu and list styles)

-andrej


  parent reply	other threads:[~2001-08-11 11:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-10  7:20 globbing Will Yardley
2001-08-10  9:09 ` globbing Borsenkow Andrej
     [not found]   ` <20010810123418.H4701@hq.newdream.net>
2001-08-11 11:10     ` Borsenkow Andrej [this message]
2001-08-11 21:23       ` globbing Bart Schaefer
2001-08-11 21:51         ` globbing Will Yardley
2001-08-12  5:42           ` globbing Borsenkow Andrej
2001-08-10  9:43 ` globbing Oliver Kiddle
2005-07-21  2:48 globbing Tyler Spivey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B7512B9.8010104@mow.siemens.ru \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=william@hq.newdream.net \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).