zsh-users
 help / color / mirror / code / Atom feed
* Re: Completion on cd
@ 1998-01-29 11:36 Oliver Kiddle
  0 siblings, 0 replies; 14+ messages in thread
From: Oliver Kiddle @ 1998-01-29 11:36 UTC (permalink / raw)
  To: zsh-users

On Jan 28,  3:26pm, B.Stephens@isode.com wrote:

> > This is one of the main things I miss from tcsh. I'm hoping those
> > recent patches have sorted this one out but I haven't yet compiled
> > that version of zsh. 
> 
> Yes.
> compctl -/ cd
> completes only directories, even beyond the first level.

Brilliant. These patches are in the recent 3.1.2-zefram version aren't
they? I'll have to compile it.

On Jan 28,  4:25pm, adam@thelonious.new.ox.ac.uk wrote:

> > cd [tab]
> > -- all non directories listed - good.
> I'm sure I'm being stupid, but why on earth would you want
> non-directories listed here?  Surely you would only want
> directories (named or otherwise) and symbolic links to
> directories listed?

I think I meant to say "all non-hidden (i.e., starting with ".") 
directories. So it was me being stupid by not reading through what I'd
written before sending it.

Oliver


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-02-02  9:38 ` Owen M. Astley
@ 1998-02-02 19:46   ` Stefan Monnier
  0 siblings, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 1998-02-02 19:46 UTC (permalink / raw)
  To: zsh-users

"Owen M. Astley" <oma1000@cam.ac.uk> writes:
> zsh doesn't complete on ./ and ../, you may have to include those
> explicitly with something like
> -g '.*(-/) ./ ../'

Since ./ is only taken into acount once you have typed . and since .. will
always be there, having ./ doesn't really help since you still have to type the
. and the / anyway. So I got rid of this one. Also having '.* ..' as you
suggest is inconvenient when there's only one .xxx subdir since instead of
completing it, zsh asks you whether you want .xxx or ..

So my choice went for:

	compctl -g '*(-/)' + -g '.*(-/)' + -g '..' cd chdir dirs pushd

I should probably add some cdpath handling but I don't use it that much anyway.


	Stefan


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-30 21:07 Oliver Kiddle
  1998-02-01  9:53 ` Andrej Borsenkow
@ 1998-02-02  9:38 ` Owen M. Astley
  1998-02-02 19:46   ` Stefan Monnier
  1 sibling, 1 reply; 14+ messages in thread
From: Owen M. Astley @ 1998-02-02  9:38 UTC (permalink / raw)
  To: zsh-users

On Fri, 30 Jan 1998, Oliver Kiddle wrote:

> On Jan 28, 10:10am, zefram@tao.co.uk wrote:
> I was hoping that these -/ options would fix my problems when I upgraded
> to 3.1.2-zefram but that wasn't the case. Using the above compctl for cd
> and the 3.1.2-zefram I still get the problems I previously described. If
> you can't remember, I shall outline it again:
> 
> % compctl -/ cd
> % cd
> % cd [tab]
>  -- Only my directories not beginning with "." are listed which is fine
> % cd .[tab]
>  -- Only my directories beginning with "." are listed which is fine
> % cd .netscape/[tab]
>  -- All the *files* and directories in .netscape/ (not starting ".") are
>  -- listed! I'd have expected it to complete to "cd .netscape/plugins/"
>  -- Also annoying is this behaviour:
> % cd ..[tab]
>  -- I get a beep! It should complete to "cd ../" as in tcsh.

I use
compctl -g '*(-/)' + -g '.*(-/)' cd

Which doesn't reproduce the behaviour that you have been describing - it
works fine even when going into the .netscape/ directory.

Another thing:
zsh doesn't complete on ./ and ../, you may have to include those
explicitly with something like

-g '.*(-/) ./ ../'



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-30 21:07 Oliver Kiddle
@ 1998-02-01  9:53 ` Andrej Borsenkow
  1998-02-02  9:38 ` Owen M. Astley
  1 sibling, 0 replies; 14+ messages in thread
From: Andrej Borsenkow @ 1998-02-01  9:53 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-users

On Fri, 30 Jan 1998, Oliver Kiddle wrote:

> > compctl -/ cd
> 
> I was hoping that these -/ options would fix my problems when I upgraded
> to 3.1.2-zefram but that wasn't the case. Using the above compctl for cd
> and the 3.1.2-zefram I still get the problems I previously described. If
> you can't remember, I shall outline it again:
> 
> % compctl -/ cd
> % cd
> % cd [tab]
>  -- Only my directories not beginning with "." are listed which is fine
> % cd .[tab]
>  -- Only my directories beginning with "." are listed which is fine
> % cd .netscape/[tab]
>  -- All the *files* and directories in .netscape/ (not starting ".") are
>  -- listed! I'd have expected it to complete to "cd .netscape/plugins/"
> 

I cannot reproduce it. compctl -/ cd correctly lists only directories,
with or without . May be, it depends on some options settings; try zsh -f.

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
@ 1998-01-30 21:07 Oliver Kiddle
  1998-02-01  9:53 ` Andrej Borsenkow
  1998-02-02  9:38 ` Owen M. Astley
  0 siblings, 2 replies; 14+ messages in thread
From: Oliver Kiddle @ 1998-01-30 21:07 UTC (permalink / raw)
  To: zsh-users

On Jan 28, 10:10am, zefram@tao.co.uk wrote:
>    compctl -g '*(D-/)' cd
> 
> is better.  The point of using + is that the non-. filenames are used
> if possible, approximating the behaviour of normal filename completion.
> Of course, with the recent compctl patches, one should use
> 
> compctl -/ cd

I was hoping that these -/ options would fix my problems when I upgraded
to 3.1.2-zefram but that wasn't the case. Using the above compctl for cd
and the 3.1.2-zefram I still get the problems I previously described. If
you can't remember, I shall outline it again:

% compctl -/ cd
% cd
% cd [tab]
 -- Only my directories not beginning with "." are listed which is fine
% cd .[tab]
 -- Only my directories beginning with "." are listed which is fine
% cd .netscape/[tab]
 -- All the *files* and directories in .netscape/ (not starting ".") are
 -- listed! I'd have expected it to complete to "cd .netscape/plugins/"
 -- Also annoying is this behaviour:
% cd ..[tab]
 -- I get a beep! It should complete to "cd ../" as in tcsh.

The new -W option is nice though and seems to work very well. Would be
nice if the -Y compctl option patch was included.

Another problem which I've been having with zsh which wasn't a problem
in 3.0.5 but is in 3.1.2 or 3.1.2-zefram is with a particular bindkey:

Under 3.0.5, I used:
bindkey '^[[161q' up-line-or-search

This meant that if I typed a letter, and then pressed Shift-Up the
history would be searched back for a line starting with what I had typed
and the cursor would be positioned at the end of the line. This worked
in the same way as "history-search-backward" from tcsh and was what I
wanted. Under zsh 3.1.2, I just get a beep when I press Shift-Up.
Instead, I have been using:
bindkey '^[[161q' history-beginning-search-backward
which I don't like as much because it leaves the cursor at the same
position.

Oliver Kiddle


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-28 13:11 Oliver Kiddle
  1998-01-28 15:26 ` Bruce Stephens
@ 1998-01-28 16:25 ` Adam Spiers
  1 sibling, 0 replies; 14+ messages in thread
From: Adam Spiers @ 1998-01-28 16:25 UTC (permalink / raw)
  To: zsh-users

Oliver Kiddle (opk101@cs.york.ac.uk) wrote:
> cd [tab]
> -- all non directories listed - good.

I'm sure I'm being stupid, but why on earth would you want
non-directories listed here?  Surely you would only want
directories (named or otherwise) and symbolic links to
directories listed?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-28 13:11 Oliver Kiddle
@ 1998-01-28 15:26 ` Bruce Stephens
  1998-01-28 16:25 ` Adam Spiers
  1 sibling, 0 replies; 14+ messages in thread
From: Bruce Stephens @ 1998-01-28 15:26 UTC (permalink / raw)
  To: zsh-users

opk101@cs.york.ac.uk said:
> cd .netscape/[tab] -- all of the *files* and directories in my
> .netscape directory listed.

> This is one of the main things I miss from tcsh. I'm hoping those
> recent patches have sorted this one out but I haven't yet compiled
> that version of zsh. 

Yes.

compctl -/ cd

completes only directories, even beyond the first level.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
@ 1998-01-28 13:11 Oliver Kiddle
  1998-01-28 15:26 ` Bruce Stephens
  1998-01-28 16:25 ` Adam Spiers
  0 siblings, 2 replies; 14+ messages in thread
From: Oliver Kiddle @ 1998-01-28 13:11 UTC (permalink / raw)
  To: zsh-users

On Jan 27,  5:35pm, lovell@fc.hp.com wrote:

> I don't have a comment on the suggestion, just my compctl setting for getting
> .<dir>'s to show up:
> 
>   # cd/pushd only directories or symbolic links to directories.  If none of those
>   # match, resort to shell variables
>   compctl -g '*(-/)' + -g '.*(-/)' -v cd pushd rmdir    

This is roughly what I use but the annoying thing is that it only works
properly for the first level of directories:

from my home:

cd [tab]
-- all non directories listed - good.
cd .[tab]
-- all hidden directories listed
cd .netscape/[tab]
-- all of the *files* and directories in my .netscape directory listed.

This is one of the main things I miss from tcsh. I'm hoping those recent
patches have sorted this one out but I haven't yet compiled that version
of zsh.

Oliver Kiddle


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-27 22:45 Wessel Dankers
  1998-01-28  0:35 ` Matthew Lovell
  1998-01-28  9:31 ` Thomas Koehler
@ 1998-01-28 10:50 ` Adam Spiers
  2 siblings, 0 replies; 14+ messages in thread
From: Adam Spiers @ 1998-01-28 10:50 UTC (permalink / raw)
  To: Zsh users mailing list

Wessel Dankers (wsl@cs.ruu.nl) wrote:
> Exploring compctl, I wanted to do completion on cd. So I used the obvious
> command:
> 
> 	compctl -g '*(-/)' cd
> 
> which gives me what I want... almost. If I enter:
> 
> 	cd .<TAB>
> 
> I get no completions.

Weird!  When I use that compctl, cd .<TAB> /does/ give me
completions.  Unfortunately cd <TAB> also includes all hidden
files in the completions list.  Why is my behaviour different?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-28  9:31 ` Thomas Koehler
@ 1998-01-28 10:10   ` Andrew Main
  0 siblings, 0 replies; 14+ messages in thread
From: Andrew Main @ 1998-01-28 10:10 UTC (permalink / raw)
  To: Thomas Koehler; +Cc: zsh-users, wsl

Thomas Koehler wrote:
>   compctl -g '*(-/) .*(-/)' cd

   compctl -g '*(D-/)' cd

is better.  The point of using + is that the non-. filenames are used
if possible, approximating the behaviour of normal filename completion.
Of course, with the recent compctl patches, one should use

compctl -/ cd

-zefram


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-27 22:45 Wessel Dankers
  1998-01-28  0:35 ` Matthew Lovell
@ 1998-01-28  9:31 ` Thomas Koehler
  1998-01-28 10:10   ` Andrew Main
  1998-01-28 10:50 ` Adam Spiers
  2 siblings, 1 reply; 14+ messages in thread
From: Thomas Koehler @ 1998-01-28  9:31 UTC (permalink / raw)
  To: zsh-users; +Cc: Wessel Dankers

On Tue, Jan 27, 1998 at 11:45:38PM +0100, Wessel Dankers wrote:

> Hi!
> 
> Exploring compctl, I wanted to do completion on cd. So I used the obvious
> command:
> 
> 	compctl -g '*(-/)' cd
> 
> which gives me what I want... almost. If I enter:
> 
> 	cd .<TAB>
> 
> I get no completions. OK, I thought, let's try a different approach.

What about

   compctl -g '*(-/) .*(-/)' cd

This should work.

CU,
Thomas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
@ 1998-01-28  0:58 Steve Talley
  0 siblings, 0 replies; 14+ messages in thread
From: Steve Talley @ 1998-01-28  0:58 UTC (permalink / raw)
  To: wsl, lovell; +Cc: zsh-users


> From lovell@fc.hp.com Tue Jan 27 17:54:03 1998
> Date: Tue, 27 Jan 1998 17:35:20 -0700 (MST)
> From: Matthew Lovell <lovell@fc.hp.com>
> To: Wessel Dankers <wsl@cs.ruu.nl>
> Cc: Zsh users mailing list <zsh-users@math.gatech.edu>
> Subject: Re: Completion on cd
> 
> I don't have a comment on the suggestion, just my compctl setting for getting
> .<dir>'s to show up:
> 
>   # cd/pushd only directories or symbolic links to directories.  If none of those
>   # match, resort to shell variables
>   compctl -g '*(-/)' + -g '.*(-/)' -v cd pushd rmdir    

also known as

compctl -g '(.*|*)(-/)'

~~
Steve


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completion on cd
  1998-01-27 22:45 Wessel Dankers
@ 1998-01-28  0:35 ` Matthew Lovell
  1998-01-28  9:31 ` Thomas Koehler
  1998-01-28 10:50 ` Adam Spiers
  2 siblings, 0 replies; 14+ messages in thread
From: Matthew Lovell @ 1998-01-28  0:35 UTC (permalink / raw)
  To: Wessel Dankers; +Cc: Zsh users mailing list

I don't have a comment on the suggestion, just my compctl setting for getting
.<dir>'s to show up:

  # cd/pushd only directories or symbolic links to directories.  If none of those
  # match, resort to shell variables
  compctl -g '*(-/)' + -g '.*(-/)' -v cd pushd rmdir    


On 27 January 1998, Wessel Dankers writes:
 > Hi!
 > 
 > Exploring compctl, I wanted to do completion on cd. So I used the obvious
 > command:
 > [crunch] 

-- 

Matthew Lovell                       voice: (970) 898-6264 
Hewlett-Packard FSL                    fax: (970) 898-2510 
3404 E. Harmony Rd. MS A0         location: 3UR4
Fort Collins, CO 80528-9599         mailto:lovell@fc.hp.com  


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Completion on cd
@ 1998-01-27 22:45 Wessel Dankers
  1998-01-28  0:35 ` Matthew Lovell
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Wessel Dankers @ 1998-01-27 22:45 UTC (permalink / raw)
  To: Zsh users mailing list

Hi!

Exploring compctl, I wanted to do completion on cd. So I used the obvious
command:

	compctl -g '*(-/)' cd

which gives me what I want... almost. If I enter:

	cd .<TAB>

I get no completions. OK, I thought, let's try a different approach.

	cdcomp() { setopt local_options null_glob; reply=($1*$2(-/)) }
	compctl -S / -q -K cdcomp cd

Almost right, but still not quite. If I enter:

	cd ^D

(^D does list-choices) I don't get slashes/at-signs behind the names
indicating whether it's a directory or a link. 

The problem is obviously that -g should be passed the current prefix and
suffix. Letting the completion mechanism select the possible entries just
isn't enough. Or would it be an idea to integrate globbing and completion
altogether, so that a * does not expand to all possible files/directories
but to all possible selections in that position. In general, these would
be files, but in other places hostnames, etc. This would be an easy way to
get, say, all hostnames, or perhaps all manpages starting with zsh...

Just an idea.

--
Wessel Dankers



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1998-02-02 20:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-29 11:36 Completion on cd Oliver Kiddle
  -- strict thread matches above, loose matches on Subject: below --
1998-01-30 21:07 Oliver Kiddle
1998-02-01  9:53 ` Andrej Borsenkow
1998-02-02  9:38 ` Owen M. Astley
1998-02-02 19:46   ` Stefan Monnier
1998-01-28 13:11 Oliver Kiddle
1998-01-28 15:26 ` Bruce Stephens
1998-01-28 16:25 ` Adam Spiers
1998-01-28  0:58 Steve Talley
1998-01-27 22:45 Wessel Dankers
1998-01-28  0:35 ` Matthew Lovell
1998-01-28  9:31 ` Thomas Koehler
1998-01-28 10:10   ` Andrew Main
1998-01-28 10:50 ` Adam Spiers

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