Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: cdablevars and cd completion in 3.1.5
- X-seq: zsh-users 1943
- From: Sweth Chandramouli <sweth@xxxxxxxxxxxxxxxxxxxx>
- To: ZSH users mailing list <zsh-users@xxxxxxxxxxxxxxx>
- Subject: Re: cdablevars and cd completion in 3.1.5
- Date: Tue, 1 Dec 1998 10:55:07 -0500
- In-reply-to: <981201041139.ZM4628@xxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: ZSH users mailing list <zsh-users@xxxxxxxxxxxxxxx>
- References: <000c01be1c7e$517212c0$21c9ca95@xxxxxxxxxxxxxxx> <981201041139.ZM4628@xxxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxx> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author