zsh-workers
 help / color / mirror / code / Atom feed
* Re: Completion on cd
       [not found] <199801280058.RAA25088@empire.Central.Sun.COM>
@ 1998-01-28  8:54 ` Wessel Dankers
  0 siblings, 0 replies; 5+ messages in thread
From: Wessel Dankers @ 1998-01-28  8:54 UTC (permalink / raw)
  To: zsh-workers

On Tue, 27 Jan 1998, Steve Talley wrote:

> >   # 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 one works!

> also known as
> 
> compctl -g '(.*|*)(-/)'

So does this one, although it might be too eager (depends on your taste): 
it also shows .dirs if you don't enter a dot at all. 

Thanks for the suggestions!

BTW, does this mean globbing-compctl should always use something like

	-g 'foo' + -g '.foo'

in it? Seems a little clumsy to me.

--
Wessel Dankers


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

* Re: Completion on cd
@ 1998-02-02 13:45 Oliver Kiddle
  0 siblings, 0 replies; 5+ messages in thread
From: Oliver Kiddle @ 1998-02-02 13:45 UTC (permalink / raw)
  To: pws, Zsh hackers list

On Feb 2, 10:12am, pws@ifh.de wrote:

> Remember you can stick '+' at the end of a completion to use the
> default as a default.  You could also try the patch I posted recently

That could be useful - I didn't know about it.

> for binding specific completions (find it at http://www.peak.org/zsh/ ,
> it's called something like 'completion widgets' and should apply
> cleanly to zsh-e.1.2-zefram3).  Then you do
> and use the special key sequence.  This is probably the only way of
> getting the level of control you want.

Well, I thing my compctl -Tx 's[~] C[0,[^/]#]' -k users -S/ completion
is doing all I want. I'll try those completion widgets though: they will
probably be useful for alternative user name completion for other
instances.

> Either you have different expectations or a different version of the
> shell from me.  Try with zsh -f again.  However, I don't understand
> where you're expecting the second / to come from, since -W will strip
> it --- it's for an implicit path, i.e. one which doesn't appear on the
> command line.  I would simply omit the -W and type the second / by
> hand or use some other compctl option to get it inserted if you
> insist, or alternatively change the omitted prefix to 's[file://]'.
> In fact, you shouldn't need to do even that since of course
> '//users/...' is recognised as a path, and -W doesn't strip more than
> you've asked it to.

I don't want a second /. A file URL is of one of two forms:

file:/path
 or
file://host/path

so I only want one / and I deal with s[file://] separately.
Anyway, I have got it working and am not quite sure why it wasn't
working before. Is there a way to have no suffix: -S '' doesn't seem to
work? Anyway, just in case anyone else wants to use it and can be
bothered to adjust it for their local web server name, it is as follows:

compctl -k '(http:// file: ftp:// gopher:// news://)' -S '' \
        -x 's[file://]' -k hostnames -S/ \
        - 's[file:/]' -/g '*.html' -W/ - 's[file:]' -s '`pwd`' -S '/' \
        - 's[http://www.york.ac.uk/~'$USER'/]' -/g '*.html' -W ~/web \
        - 's[http://www.york.ac.uk/~]' -k users -S/ + -u -S/ \
        - 's[http://www.york.ac.uk/]' -g '*.html' -W '/usr/local/web' \
        - 's[http://www]' -k '(.york.ac.uk)' -S/ \
        - 's[http://a]' -k '(tlas.cs.york.ac.uk)' -S/ \
        - 's[http://]' -k '(atlas www)' -S '.' \
        - 's[-]' -k '(anonymous auth base book buried_news cache case
cfg child cookies crawl display dump editor emacskeys enable_scrollback
error_file fileversions force_html from ftp get_data head help
historical homepage image_links index link localhost locexec mime_header
minimal newschunksize newsmaxchunk nobrowse noexec nofilereferer
nofilereferer nolist nolog nopause noprint noredir noreferer nosocks
nostatus number_links popup post_data print pseudo_inlines raw realm
reload restrictions resubmit_posts rlogin selective show_cursor source
startfile_ok telnet term trace traversal underscore validate version
vikeys)' \
        -- lynx

Cheers

Oliver Kiddle


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


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

* Re: Completion on cd
  1998-02-01 15:52 Oliver Kiddle
@ 1998-02-02  9:12 ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 1998-02-02  9:12 UTC (permalink / raw)
  To: Zsh hackers list

Oliver Kiddle wrote:
> > You would be probably better off by using -D flag. It allows you to
> > override it on per-command/per-argument basis and still be applied in
> > default case. In most cases it should be the same as you have, with
> > exception that -/ will work :-)
> 
> I don't think that the -D flag would be better. I would then have to
> program the alternative '~' expansion in for every command. Also, the -T
> flags operates when completing the command itself if I run a command in
> a user's directory.

Remember you can stick '+' at the end of a completion to use the
default as a default.  You could also try the patch I posted recently
for binding specific completions (find it at http://www.peak.org/zsh/ ,
it's called something like 'completion widgets' and should apply
cleanly to zsh-e.1.2-zefram3).  Then you do

zle -C alternative-tilde-expansion <completion options here>
bindkey "<key sequence>" alternative-tilde-expansion

and use the special key sequence.  This is probably the only way of
getting the level of control you want.

> The following does not work as I would expect:
> compctl -x 's[file:/]' -/g '*.html' -W '/' -- lynx

Either you have different expectations or a different version of the
shell from me.  Try with zsh -f again.  However, I don't understand
where you're expecting the second / to come from, since -W will strip
it --- it's for an implicit path, i.e. one which doesn't appear on the
command line.  I would simply omit the -W and type the second / by
hand or use some other compctl option to get it inserted if you
insist, or alternatively change the omitted prefix to 's[file://]'.
In fact, you shouldn't need to do even that since of course
'//users/...' is recognised as a path, and -W doesn't strip more than
you've asked it to.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +39 50 911239
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


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

* Re: Completion on cd
@ 1998-02-01 15:52 Oliver Kiddle
  1998-02-02  9:12 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 1998-02-01 15:52 UTC (permalink / raw)
  To: borsenkow.msk; +Cc: Zsh workers mailing list

On Feb 1,  6:12pm, borsenkow.msk@sni.de wrote:

> On Sun, 1 Feb 1998, Oliver Kiddle wrote:
> > I tracked the problem down to this line:
> > 
> > compctl -Tx 'C[0,*/*]' -f - 's[~]' -k users -S/ \
>           ^^^^^^^^^^^^^^^^^
> 
> Yep. -T applies *before* anything else, and you just told it, that */*
> must complete all files.  I am curious, if 'cd dir1/dir2/xTAB' works
> correctly (that is, if pattern doesn't descend :-)

Yes, I didn't think about the '-f' bit and */* matching anything with a
slash in it when I took the completion out the manual. I don't
understand what you mean by the last sentence. I think the answer is
that it does work correctly.
 
> You would be probably better off by using -D flag. It allows you to
> override it on per-command/per-argument basis and still be applied in
> default case. In most cases it should be the same as you have, with
> exception that -/ will work :-)

I don't think that the -D flag would be better. I would then have to
program the alternative '~' expansion in for every command. Also, the -T
flags operates when completing the command itself if I run a command in
a user's directory.

> > There may well be a problem with this though it seems to work and I
> > can't see any nasty suprises but I would strongly suggest that the
> > manual is changed so that nobody else has this problem. 
> Sorry, in which respect? Manual *does* say, that -T is default applied
> before anything else. 

I meant that there might be a problem with my new compctl not with zsh
itself. I don't think there is though. I was thinking that there might
be some other respect where my compctl would interfere with some other
intended completion to give undesired results as I found to be the case
for the original compctl which is an example in the manual. 

Another compctl problem I've had is with a compctl I'm trying to
construct for lynx based on one I have working under tcsh:

The following does not work as I would expect:
compctl -x 's[file:/]' -/g '*.html' -W '/' -- lynx

The problem seems to occur with the slash character as this does work
as expected (although it doesn't do anything useful):
compctl -x 's[file:]' -/g '*.html' -W '/' -- lynx

(As does 's[file:]' -S/ -s '`pwd`' which is the useful completion 
of 'file:' only).

Oliver Kiddle

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


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

* Re: Completion on cd
       [not found] <swordfish.886344199@student.cs.york.ac.uk>
@ 1998-02-01 15:12 ` Andrej Borsenkow
  0 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 1998-02-01 15:12 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: Zsh workers mailing list

On Sun, 1 Feb 1998, Oliver Kiddle wrote:

> 
> I tracked the problem down to this line:
> 
> compctl -Tx 'C[0,*/*]' -f - 's[~]' -k users -S/ \
          ^^^^^^^^^^^^^^^^^

Yep. -T applies *before* anything else, and you just told it, that */*
must complete all files.  I am curious, if 'cd dir1/dir2/xTAB' works
correctly (that is, if pattern doesn't descend :-)

You would be probably better off by using -D flag. It allows you to
override it on per-command/per-argument basis and still be applied in
default case. In most cases it should be the same as you have, with
exception that -/ will work :-)

> There may well be a problem with this though it seems to work and I
> can't see any nasty suprises but I would strongly suggest that the
> manual is changed so that nobody else has this problem. 
> 

Sorry, in which respect? Manual *does* say, that -T is default applied
before anything else. 


> Note that the problem with cd ..[tab] beeping as opposed to completing
> to cd ../ is still there.
> 

I agree, that it must be sorted. At least, -/ must complete .. as
well.

-------------------------------------------------------------------------
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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199801280058.RAA25088@empire.Central.Sun.COM>
1998-01-28  8:54 ` Completion on cd Wessel Dankers
     [not found] <swordfish.886344199@student.cs.york.ac.uk>
1998-02-01 15:12 ` Andrej Borsenkow
1998-02-01 15:52 Oliver Kiddle
1998-02-02  9:12 ` Peter Stephenson
1998-02-02 13:45 Oliver Kiddle

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