zsh-users
 help / color / mirror / code / Atom feed
* completion for dotdirs/symlinks to directories
@ 2002-08-27 21:34 Eric.D.Friedman
  2002-08-28 11:13 ` Phil Pennock
  0 siblings, 1 reply; 3+ messages in thread
From: Eric.D.Friedman @ 2002-08-27 21:34 UTC (permalink / raw)
  To: zsh-users

Hello,

My .zshrc currently uses the following set for completing "cd" and friends:

# cd/pushd only directories or symbolic links to directories
compctl -g '*(-/)' cd chdir dirs pushd
# skips CVS when changing directories
# compctl -g '*~(*/)#CVS(/)' cd
compctl -g '*(-/)' -g '*~(*/)#CVS(/)' cd chdir dirs pushd

My goal is to be able to skip past CVS directories when completing a path
and to have only directories and symlinks to directories be legal completion
targets.

Currently there are two problems:

(1) I can't get completions for directories that start with a "."  ; and

(2) symlinks to directories do not work.

I'm using zsh-4.0.2 on solaris.

I tried putting "D" in the first completion rule [ as in -g "$(D-/)" ] but
that didn't work out.

Can anyone set me straight?

Thanks,
Eric


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

* Re: completion for dotdirs/symlinks to directories
  2002-08-27 21:34 completion for dotdirs/symlinks to directories Eric.D.Friedman
@ 2002-08-28 11:13 ` Phil Pennock
  2002-08-28 20:32   ` Phil Pennock
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Pennock @ 2002-08-28 11:13 UTC (permalink / raw)
  To: Eric.D.Friedman; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]

On 2002-08-27 at 14:34 -0700, Eric.D.Friedman@WellsFargo.COM wrote:
> My .zshrc currently uses the following set for completing "cd" and friends:
> 
> # cd/pushd only directories or symbolic links to directories
> compctl -g '*(-/)' cd chdir dirs pushd
> # skips CVS when changing directories
> # compctl -g '*~(*/)#CVS(/)' cd
> compctl -g '*(-/)' -g '*~(*/)#CVS(/)' cd chdir dirs pushd

Doesn't the second uncommented one replace the first one?

> (1) I can't get completions for directories that start with a "."  ; and

'D' glob modifier, as you noticed.

> (2) symlinks to directories do not work.

'-', as you noticed.

> I'm using zsh-4.0.2 on solaris.

Thanks -- I see too many reports where that basic info isn't included.
It's not needed in this case, but better to have five words too many
than to miss a vital clue.  :^)

> I tried putting "D" in the first completion rule [ as in -g "$(D-/)" ] but
> that didn't work out.

$(...) is command substitution -- the POSIX form of `...`, with
different rules on escaping metacharacters.

> Can anyone set me straight?

How about:
 compctl -g '*~CVS(D-/)' cd chdir dirs pushd

Anything except CVS, and then modifier flags.
Works here (4.0.2/OpenBSD).
-- 
Democracy is three wolves and a sheep voting on what's for dinner.

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

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

* Re: completion for dotdirs/symlinks to directories
  2002-08-28 11:13 ` Phil Pennock
@ 2002-08-28 20:32   ` Phil Pennock
  0 siblings, 0 replies; 3+ messages in thread
From: Phil Pennock @ 2002-08-28 20:32 UTC (permalink / raw)
  To: Eric.D.Friedman, zsh-users

[-- Attachment #1: Type: text/plain, Size: 903 bytes --]

On 2002-08-28 at 13:13 +0200, I wrote:
> How about:
>  compctl -g '*~CVS(D-/)' cd chdir dirs pushd
> 
> Anything except CVS, and then modifier flags.
> Works here (4.0.2/OpenBSD).

I finally got around to actually using this properly for myself, and
very quickly found a flaw.  When excluding, it only matches _exactly_
the path "CVS" in the current directory.  If you have a larger CVS tree,
then CVS entries in that can be matched.

Try:
 compctl -g '*~(*/)#CVS(D-/)' cd chdir dirs pushd 

Which excludes: zero-or-more sequences of "*/", followed by "CVS".

Stunning how quickly the flaw in the original becomes noticeable when
you're migrating to a new CVS server and only have one project, nested
deeply, checked out.  ;^)  Now, three tabs and I'm there.
-- 
I'm reasonably sure that I slept last night because I think that I woke up
two or three times.  Why am I a sysadmin?

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

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

end of thread, other threads:[~2002-08-28 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-27 21:34 completion for dotdirs/symlinks to directories Eric.D.Friedman
2002-08-28 11:13 ` Phil Pennock
2002-08-28 20:32   ` Phil Pennock

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