zsh-users
 help / color / mirror / code / Atom feed
* Controlling the order of -/g produced files and directories
@ 1998-08-24 15:34 Hannu Koivisto
  1998-08-24 17:14 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Hannu Koivisto @ 1998-08-24 15:34 UTC (permalink / raw)
  To: Zsh User's List

Greetings,

I'd like to make such a completion for my utgz and vtgz shell
functions that it matches to *.tgz, *.tar.gz and directories.

My first attempt was as follows:

compctl -g '*.(tgz|tar.gz)' + -g '*(/)' utgz vtgz

This has the problem that the latter pattern is not considered
if the first matches. From completion examples I found "-/g"
option and decided to try it. That is,
compctl -/g '*.(tgz|tar.gz)' utgz vtgz

Although I didn't find explanation for this -/g option in the
documentation, this version seems to work. However, I would
prefer that if some directory has both matching files and
subdirectories then those files would be first in the list of
completions and those directories last. How should this be done?

TIA,
//Hannu


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

* Re: Controlling the order of -/g produced files and directories
  1998-08-24 15:34 Controlling the order of -/g produced files and directories Hannu Koivisto
@ 1998-08-24 17:14 ` Bart Schaefer
  1998-08-25 10:24   ` Hannu Koivisto
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 1998-08-24 17:14 UTC (permalink / raw)
  To: Hannu Koivisto, Zsh User's List

On Aug 24,  6:34pm, Hannu Koivisto wrote:
} Subject: Controlling the order of -/g produced files and directories
}
} I'd like to make such a completion for my utgz and vtgz shell
} functions that it matches to *.tgz, *.tar.gz and directories.
} 
} compctl -/g '*.(tgz|tar.gz)' utgz vtgz
} 
} Although I didn't find explanation for this -/g option

That's not one option, it's two:
	-/
	-g '*.(tgz|tar.gz)'

It happens that you can run them together as -/g because -/ doesn't
take any additional arguments.  -/ means "complete filesystem paths."

} However, I would prefer that if some directory has both matching
} files and subdirectories then those files would be first in the
} list of completions and those directories last.

Zsh currently sorts the completion list itself, alphabetically; there
has been discussion of changing this on the developer's list, but at
the moment you can't force files to sort ahead of directories.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: Controlling the order of -/g produced files and directories
  1998-08-24 17:14 ` Bart Schaefer
@ 1998-08-25 10:24   ` Hannu Koivisto
  0 siblings, 0 replies; 3+ messages in thread
From: Hannu Koivisto @ 1998-08-25 10:24 UTC (permalink / raw)
  To: Zsh User's List

"Bart Schaefer" <schaefer@brasslantern.com> writes:

| } Although I didn't find explanation for this -/g option
| 
| That's not one option, it's two:
| 	-/
| 	-g '*.(tgz|tar.gz)'

Well, now that I checked it, I couldn't find explanation for -/
option either. It seems that the info manual of my zsh 3.1.2(-8,
this is from the Debian GNU/Linux 2.0 distribution) is pretty
old:
"""
Document Edition 2.1.10, last updated 15 October 1996, of `The Z Shell
Guide', for zsh, Version 3.0.1.
"""

I hope there will be an updated version because it seems that
there are new interesting features in latest zsh versions that I
am not aware of.

| Zsh currently sorts the completion list itself, alphabetically; there
| has been discussion of changing this on the developer's list, but at
| the moment you can't force files to sort ahead of directories.

Ok. Count me as interested in such a feature :)

Thanks for the information,
//Hannu


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

end of thread, other threads:[~1998-08-25 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-24 15:34 Controlling the order of -/g produced files and directories Hannu Koivisto
1998-08-24 17:14 ` Bart Schaefer
1998-08-25 10:24   ` Hannu Koivisto

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