zsh-users
 help / color / mirror / code / Atom feed
* dynamic globbing for cdpath?
@ 2008-10-22 19:24 Eric D. Friedman
  2008-10-23  3:07 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Eric D. Friedman @ 2008-10-22 19:24 UTC (permalink / raw)
  To: Zsh Users

Is it possible to have an entry in cdpath that contains a shell
globbing pattern that gets reevaulated when I press cd <TAB> ?

Suppose that I have this structure

mkdir -p $HOME/{foo,bar,baz}/branches/

Under those branch directories, there are several distinct subdirs

I'd like to have the branches dirs on my cdpath so that I can cd into
any of the subdirs.

cdpath=($HOME/*/branches)

The issue is that "foo,bar,baz" might grow/shrink to contain new
entries and I'd rather not have to reset cdpath to re-glob.

Is there something I can put into cdpath that will get reevaluated
when I do a cd <TAB>? 


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

* Re: dynamic globbing for cdpath?
  2008-10-22 19:24 dynamic globbing for cdpath? Eric D. Friedman
@ 2008-10-23  3:07 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2008-10-23  3:07 UTC (permalink / raw)
  To: Zsh Users

On Oct 22, 12:24pm, Eric D. Friedman wrote:
}
} Is it possible to have an entry in cdpath that contains a shell
} globbing pattern that gets reevaulated when I press cd <TAB> ?

You're really asking two almost-unrelated questions here.

The cdpath value might be used by completion, but where it really
matters is when you type "cd somewhere<RETURN>" without completing
first.  No, it's not possible to introduce a glob into that.

What's your objection to resetting cdpath?  You could do it in your
precmd function, for example, so you never have to notice it.

As for the completion-related part of your question, you can use
the fake-files style.  Although the name of the style implies that
the files might not really be there, you can populate the value
with actual files if you want to.  Start with something like this:

zstyle -e ':completion:*' fake-files \
	'reply=($HOME/*/branches); reply=(:"${(@)reply#$HOME/}")' 

Then tweak to suit your preferred behavior.

-- 


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

end of thread, other threads:[~2008-10-23  3:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-22 19:24 dynamic globbing for cdpath? Eric D. Friedman
2008-10-23  3:07 ` Bart Schaefer

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