zsh-users
 help / color / mirror / code / Atom feed
* compctl for cd
@ 1997-06-13  0:36 Oliver P. Kiddle (3Y0)
  0 siblings, 0 replies; only message in thread
From: Oliver P. Kiddle (3Y0) @ 1997-06-13  0:36 UTC (permalink / raw)
  To: zsh-users

I wonder if anyone could help me - I'm having a bit of trouble with 
completion for cd.

I am trying to get it to work in the same way as tcsh (which I am 
currently converting from) but have come across a couple problems.

Note: 
  Under tcsh, I used: complete cd 'n/*/d/'
  I'm using zsh 3.0.1 

Under tcsh, if I type cd [tab], It lists all directories except those
starting with a dot but is still happy if I type cd .[tab] to complete
directories starting with a dot and to list them. 

I tried to achieve this but the nearest I got was:
compctl -g '*(-/)' -x 'S[.]' -g '*(D,-/)' -- cd mkdir rmdir
This only matches with dot directories if the current word begins with a 
dot so for example, it is useless with bin/.something. I can't find a way of
matching this properly (as */.[^/] if you understand that).

As I experimented, I noticed a problem with the first expression in the 
completion: if from my home directory I did:

cd b[tab]    # No problem, expands to bin/
cd bin/[tab] # Now, all the files in bin aswell as directories are listed

If you use:
compctl -g '(*/)##' cd
then it will list all directories recursively with their names relative 
to the current which is no use.

Can anyone think of a solution (preferably without resorting to the use 
of functions)?

What would be nice would be if there was an option similar to -g but 
which took all directories up to the last slash in the current word 
and performed the glob as if that was the current directory.

While I'm e-mailing this list, I'll also point out in reference to the 
tilde expansion message recently sent by Wez that the manual contains a 
similar completion:

compctl -Tx 'C[0,*/*]' -f - 's[~]' -k friends -S/

This applies the expansion across the line and not just to the command and 
seems to work better.

Cheers

Oliver Kiddle

--
 __
/  \|.   _ _  |_/. _| _|| _     E-mail: opk101@cs.york.ac.uk
\__/||\/(-|   | \|(_|(_||(-        Web: http://www.york.ac.uk/~opk101/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-06-13  0:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-13  0:36 compctl for cd Oliver P. Kiddle (3Y0)

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