zsh-users
 help / color / mirror / code / Atom feed
* completion and .files
@ 1997-02-23 19:34 Nikita Borisov
  1997-02-23 21:31 ` Zefram
  1997-02-23 21:32 ` Hrvoje Niksic
  0 siblings, 2 replies; 3+ messages in thread
From: Nikita Borisov @ 1997-02-23 19:34 UTC (permalink / raw)
  To: zsh-users

Whenever I create a complection that uses the -g option of compctl, I
lose the ability to handle .files the way I want, which is simply to say
the same way that zsh handles them normally.

Here's an example - compctl rule for cd.  I start out with the
following:

Attempt #1:
compctl -g '*(-/x)' cd

Now "cd <TAB>" gives me the proper completions for all the directories.
However, "cd .foo<TAB>" gives me an empty completion list, because no
.files match the -g pattern that I give.

Attempt #2:
compctl -g '*(-/x)' -x 'S[.]' -g '.*(-/x)' -- cd 

This fixes the original problem, but "cd ~/.foo<TAB>" fails once again.

Attempt #3:

compctl -g '(.|)*(-/x)' -- cd

This at least gets all the .directories; however 'cd <TAB>' lists all
my .directories as well.

What I'm basically looking for is to get at all the files that zsh would
have listed had I not used a compctl rule, and filter out any that are
not directories.


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

* Re: completion and .files
  1997-02-23 19:34 completion and .files Nikita Borisov
@ 1997-02-23 21:31 ` Zefram
  1997-02-23 21:32 ` Hrvoje Niksic
  1 sibling, 0 replies; 3+ messages in thread
From: Zefram @ 1997-02-23 21:31 UTC (permalink / raw)
  To: Nikita Borisov; +Cc: zsh-users

Nikita Borisov wrote:
>Attempt #2:
>compctl -g '*(-/x)' -x 'S[.]' -g '.*(-/x)' -- cd 
>
>This fixes the original problem, but "cd ~/.foo<TAB>" fails once again.

How about

compctl -g '*(-/x)' + -g '*(D-/x)' cd

i.e., try normal globbing first, and if that fails, try again allowing
dot files.

>What I'm basically looking for is to get at all the files that zsh would
>have listed had I not used a compctl rule, and filter out any that are
>not directories.

I'd like to implement the ability to do this directly.  I'd like some
way for completion functions to reinvoke the compctl mechanism to
provide it with an array of completions using a normal compctl recipe,
so it could implement more extravagant conditional completions and do
tweaks that a plain compctl can't.  Is this a good idea?

-zefram


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

* Re: completion and .files
  1997-02-23 19:34 completion and .files Nikita Borisov
  1997-02-23 21:31 ` Zefram
@ 1997-02-23 21:32 ` Hrvoje Niksic
  1 sibling, 0 replies; 3+ messages in thread
From: Hrvoje Niksic @ 1997-02-23 21:32 UTC (permalink / raw)
  To: Nikita Borisov; +Cc: zsh-users

Nikita Borisov <nborisov@calum.csclub.uwaterloo.ca> writes:

> Attempt #1:
> compctl -g '*(-/x)' cd

Why don't you use `*(D-/x)' pattern?  The `d' means to include all the
dots except `.' and `..'.  I use:

compctl -g *(D-/) cd

in my .zshrc.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
main(){printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}


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

end of thread, other threads:[~1997-02-23 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-02-23 19:34 completion and .files Nikita Borisov
1997-02-23 21:31 ` Zefram
1997-02-23 21:32 ` Hrvoje Niksic

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