zsh-users
 help / color / mirror / code / Atom feed
* How to strip off common prefix for array elements?
@ 1998-02-19 11:10 Andrej Borsenkow
  1998-02-19 20:11 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Andrej Borsenkow @ 1998-02-19 11:10 UTC (permalink / raw)
  To: Zsh users mailing list

Consider the case:

cdpath=(~ ~/src ~/build/mips)
cd zshTAB -> gives me zsh-3.1.2 which is O.K., but I don't have any chance
to cd into build, because ~/src stays in the way.

The problem amounts to:

array of possile completions:
  ~/src/zsh-3.1.2 ~/build/mips/zsh-3.1.2
array of directories
  ~ ~/src ~/build/mips
Now I have to find the longest prefix from $cdpath elements so, that
remaining parts of completions are still uniq. 

the best way I can think of involves quite tedious loops over first and
second array. I had a vague hope, that it could be done with ZSH's magic
in parameter substitution. BTW somebody has an idea of extensions to allow
this be done (in general way)?

I am referring to Zoltan's cdmatch function. Currently it is nice 
one-liner - can it do the above and still remain small?

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



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

end of thread, other threads:[~1998-02-19 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-19 11:10 How to strip off common prefix for array elements? Andrej Borsenkow
1998-02-19 20:11 ` 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).