zsh-users
 help / color / mirror / code / Atom feed
* Problem with complete-all
@ 2004-08-13  7:45 Jesper Holmberg
  2004-08-13  9:33 ` Oliver Kiddle
  0 siblings, 1 reply; 5+ messages in thread
From: Jesper Holmberg @ 2004-08-13  7:45 UTC (permalink / raw)
  To: Zsh-users List

I can't get complete-all to work as I would like it to. Perhaps I have
misunderstood what it's supposed to be doing, so I'll try to describe what
I want to accomplish.

I use the new completion system with menu-complete bound to <TAB>.
Suppose that I have a directory which is under CVS version control, and
that I have added a couple of files to this directory. If I now go: 

cvs add <TAB>

the completion system supplies one of the added files, which is very nice.
Pressing <TAB> again switches to the next added file, until I have cycled
through them all.

Now, what I thought would be possible to accomplish with complete-all
(bound to, say, '^Xx') would be that when I go:

cvs add ^Xx

all the files which have been added would be put on the command line at
the same time. However, what happens is that zsh beeps and nothing else,
not even an error message. Doing a 'describe-key-briefly' on '^Xx' shows
'all-matches'.

This is what I have in my .zshrc, taken from the manual:

zle -C all-matches complete-word _generic
bindkey '^Xx' all-matches
zstyle ':completion:all-matches:*' old-matches only
zstyle ':completion:all-matches::::' completer _all_matches

What am I doing wrong?

TIA,

Jesper


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

* Re: Problem with complete-all
  2004-08-13  7:45 Problem with complete-all Jesper Holmberg
@ 2004-08-13  9:33 ` Oliver Kiddle
  2004-08-13  9:58   ` Oliver Kiddle
  2004-08-16  6:46   ` Jesper Holmberg
  0 siblings, 2 replies; 5+ messages in thread
From: Oliver Kiddle @ 2004-08-13  9:33 UTC (permalink / raw)
  To: Jesper Holmberg; +Cc: Zsh-users List

Jesper Holmberg wrote:
> I can't get complete-all to work as I would like it to. Perhaps I have

> This is what I have in my .zshrc, taken from the manual:

It seems we need to fix the example in the manual.

> zle -C all-matches complete-word _generic
> bindkey '^Xx' all-matches
> zstyle ':completion:all-matches:*' old-matches only
> zstyle ':completion:all-matches::::' completer _all_matches

Try changing the last style to add _complete after _all_matches:
  zstyle ':completion:all-matches::::' completer _all_matches _complete
It needs _complete there to actually generate some matches.

I also use this:
  zstyle ':completion:all-matches:*' insert true
which makes it just insert the matches instead of giving you them as
an extra match.

and this:
  zstyle ':completion:all-matches:*' file-patterns \
      '%p:globbed-files' '*(-/):directories' '*:all-files'
That prevents it from inserting all the sub-directories in cases where
subdirectories are only completed to allow you to complete files within
them.

Oliver


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

* Re: Problem with complete-all
  2004-08-13  9:33 ` Oliver Kiddle
@ 2004-08-13  9:58   ` Oliver Kiddle
  2004-08-16  6:46   ` Jesper Holmberg
  1 sibling, 0 replies; 5+ messages in thread
From: Oliver Kiddle @ 2004-08-13  9:58 UTC (permalink / raw)
  To: Zsh-users List

I wrote:
> It seems we need to fix the example in the manual.

> Try changing the last style to add _complete after _all_matches:
>   zstyle ':completion:all-matches::::' completer _all_matches _complete
> It needs _complete there to actually generate some matches.

Sorry to reply to my own post but I thought I should point out that the
manual isn't actually wrong. With the completer style from the manual,
_all_matches does work. It reuses the matches from the previous completion
so you have to press tab before ^Xx. The style I suggested allows you
to just press ^Xx or whatever key you have bound. It needs that insert
style too, though.

Oliver


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

* Re: Problem with complete-all
  2004-08-13  9:33 ` Oliver Kiddle
  2004-08-13  9:58   ` Oliver Kiddle
@ 2004-08-16  6:46   ` Jesper Holmberg
  2004-08-17 10:28     ` Jesper Holmberg
  1 sibling, 1 reply; 5+ messages in thread
From: Jesper Holmberg @ 2004-08-16  6:46 UTC (permalink / raw)
  To: Zsh-users List

* On Fri Aug 13, Oliver Kiddle wrote:
> It seems we need to fix the example in the manual.
> 
> > zle -C all-matches complete-word _generic
> > bindkey '^Xx' all-matches
> > zstyle ':completion:all-matches:*' old-matches only
> > zstyle ':completion:all-matches::::' completer _all_matches
> 
> Try changing the last style to add _complete after _all_matches:
>   zstyle ':completion:all-matches::::' completer _all_matches _complete
> It needs _complete there to actually generate some matches.

Thank you for your reply, Oliver. It still doesn't work exactly as I'd
expect, though.

This is what I now have in my .zshrc:

zle -C all-matches complete-word _generic
bindkey '^Xx' all-matches
zstyle ':completion:all-matches:*' old-matches only
zstyle ':completion:all-matches::::' completer _all_matches _complete
zstyle ':completion:all-matches:*' insert true
zstyle ':completion:all-matches:*' file-patterns \
    '%p:globbed-files' '*(-/):directories' '*:all-files'


Now, if I for example have added the files "file" and "text", I have to
press '^Xx' twice before the added files are inserted after 'cvs add '.
Pressing it once doesn't have any effect.

If I have added the files "file1" and "file2", pressing '^Xx' once gives
me "file" on the command line, i.e. it completes the unique part, just
like complete-word usually does. Pressing '^Xx' another time gives me both
file-names.

How can I change this so that '^Xx' inserts all the files the first time
it is used?

Jesper


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

* Re: Problem with complete-all
  2004-08-16  6:46   ` Jesper Holmberg
@ 2004-08-17 10:28     ` Jesper Holmberg
  0 siblings, 0 replies; 5+ messages in thread
From: Jesper Holmberg @ 2004-08-17 10:28 UTC (permalink / raw)
  To: Zsh-users List

* On Mon Aug 16, Jesper Holmberg wrote:
> 
> Thank you for your reply, Oliver. It still doesn't work exactly as I'd
> expect, though.

Sorry for replying to my own post, but I believe I found the problem. Changing
the old-matches line to 

zstyle ':completion:all-matches:*' old-matches false

seems to fix my problem, now pressing '^Xx' inserts everything at once, no
questions asked.

Jesper


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

end of thread, other threads:[~2004-08-17 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-13  7:45 Problem with complete-all Jesper Holmberg
2004-08-13  9:33 ` Oliver Kiddle
2004-08-13  9:58   ` Oliver Kiddle
2004-08-16  6:46   ` Jesper Holmberg
2004-08-17 10:28     ` Jesper Holmberg

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