From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18979 invoked from network); 1 Dec 1998 15:58:10 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 1 Dec 1998 15:58:10 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id KAA15846; Tue, 1 Dec 1998 10:52:58 -0500 (EST) Resent-Date: Tue, 1 Dec 1998 10:52:52 -0500 (EST) Message-ID: <19981201105507.D6080@astaroth.nit.gwu.edu> Date: Tue, 1 Dec 1998 10:55:07 -0500 From: Sweth Chandramouli To: ZSH users mailing list Subject: Re: cdablevars and cd completion in 3.1.5 Mail-Followup-To: ZSH users mailing list References: <000c01be1c7e$517212c0$21c9ca95@mowp.siemens.ru> <981201041139.ZM4628@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i In-Reply-To: <981201041139.ZM4628@candle.brasslantern.com> Resent-Message-ID: <"D1RN02.0.2t3.I31Ps"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1943 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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" to get "cd sweth", vs. "cd sw", 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 / (202) 994 - 8521 (V) / (202) 994 - 0458 (F) *