zsh-users
 help / color / mirror / code / Atom feed
From: opk101@cs.york.ac.uk (Oliver P. Kiddle (3Y0))
To: zsh-users@math.gatech.edu
Subject: compctl for cd
Date: Fri, 13 Jun 1997 01:36:55 +0100	[thread overview]
Message-ID: <swordfish.866162219@ugrad.cs.york.ac.uk> (raw)

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/


                 reply	other threads:[~1997-06-13  0:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=swordfish.866162219@ugrad.cs.york.ac.uk \
    --to=opk101@cs.york.ac.uk \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).