zsh-users
 help / color / mirror / code / Atom feed
From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: ZSH users mailing list <zsh-users@math.gatech.edu>
Subject: Re: cdablevars and cd completion in 3.1.5
Date: Tue, 1 Dec 1998 10:55:07 -0500	[thread overview]
Message-ID: <19981201105507.D6080@astaroth.nit.gwu.edu> (raw)
In-Reply-To: <981201041139.ZM4628@candle.brasslantern.com>

On Tue, Dec 01, 1998 at 04:11:39AM -0800, Bart Schaefer wrote:
> So the question is: Can one complete within a named directory?
> 
> Which implies the question:  Can one complete named directories?
> 
> Let's start with the basic completion for diretories.  In 3.0.5, that's
> 
>     compctl -g '*(-/)' cd pushd
> 
> If you also want to complete directories that begin with a ".", you need
> 
>     compctl -g '*(-/)' + -g '*(-/D)' cd pushd
> 
> In 3.1.5, almost the same effect is achieved more simply with
> 
>     compctl -/ cd pushd
> 
> (the difference being that the 3.0.5 completion returns directories that
> begin with a "." anytime there are no other matching directories, whereas
> the -/ completion always requires that the "." be explicitly typed).  From
> here on I'm going to use -/ in all examples, but unless I say otherwise
> they'll work in 3.0.5 too if you replace -/ with the -g patterns above.

	i'm running 3.1.4, with "compctl -g '*(-/)' cd pushd", and i get tab 
completion on all matching directories, including ones with dot-prefixes, even 
if not explicitly typed... i just checked, and i get the same behaviour with 
just "compctl -/ cd pushd".  the manpage for zshcompctl describes the -/ flag as 
completing "Just filesystem paths"; what about that would imply that 
dot-prefixes should not be included?  is the behaviour you describe a change in 
3.1.5?

> Now the obligatory bit of zsh arcana that still confuses me:
> 
> zsh% echo ~/zshfun
> /home/schaefer/zshfun
> zsh% cd HE
>          ^
> 	 With cursor here, this calls cdmatch and completes HOME/.
> 	 But if instead I have
> zsh% cd HE/zshfun
>          ^
> 	 With the cursor here, pressing tab does NOT call cdmatch!
> 	 Why not?  I have completeinword set.  The word under the
> 	 cursor contains a /, so it should match n[-1,/].  I expected
> 	 it to call cdmatch with 1=H 2=E/zshfun and to be able to
> 	 read HE/zshfun into $pref.  If Instead I have
> zsh% cd HOME/zn
>               ^
> 	      with the cursor here, I can complete to HOME/zshfun.

	at first, i assumed you meant $HOME and not just HOME.  some further 
checking, however, shows that zsh seems to do a check of environment variables 
if you try to cd to a directory that is not in your path and not a named 
directory, and if it finds a matching env. var., it implicitly names the 
corresponding directory:
	
(astaroth)~: cd ~
adm        chuck      listen     noaccess   oracle7    sirk       sys        
arch       daemon     lp         nobody     perl       smtp       throck     
bench      jasonbb    mddeath    nobody4    root       src        truyen     
bin/       leif       netscape   nuucp      roth       sweth      
(astaroth)~: cd FPATH 
~FPATH
(astaroth)~: cd ~
FPATH      bin/       leif       netscape   nuucp      roth       sweth      
adm        chuck      listen     noaccess   oracle7    sirk       sys        
arch       daemon     lp         nobody     perl       smtp       throck     
bench      jasonbb    mddeath    nobody4    root       src        truyen

	my tab-completion doesn't work at all against named directories unless 
i've explicitly prefixed them with a ~ (e.g. "cd ~sw<TAB>" to get "cd sweth", 
vs. "cd sw<TAB>", which does nothing), and i don't have time right now to dig 
into your (impressive and very tempting) completion, but my best guess would be 
that it has something to do with the way that that implicit naming takes place.  
do you get the same behaviour when trying
	
zsh% cd ~HE/zshfun
          ^cursor here when tabbing
          
          -- sweth.
	
-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


  reply	other threads:[~1998-12-01 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-30 16:27 Andrej Borsenkow
1998-12-01 12:11 ` Bart Schaefer
1998-12-01 15:55   ` Sweth Chandramouli [this message]
1998-12-01 18:24     ` Bart Schaefer
1998-12-01 19:02     ` Andrej Borsenkow

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=19981201105507.D6080@astaroth.nit.gwu.edu \
    --to=sweth@astaroth.nit.gwu.edu \
    --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).