zsh-workers
 help / color / mirror / code / Atom feed
From: opk@thoth.u-net.com (Oliver Kiddle)
To: zsh-workers@sunsite.auc.dk
Subject: Re: Completion suggestions
Date: Sun, 14 Feb 1999 11:54:06 +0000	[thread overview]
Message-ID: <199902141154.LAA13108@Indigo.thoth.u-net.com> (raw)

On Feb 8, 10:12am, Sven Wischnowsky wrote:
> Oliver Kiddle wrote:
> > [ Quote aware completion suggestion ]
> 
> As an option, maybe. But if you have something like zsh -c "ls f<TAB>", 
> you'll want all files.

Good point. I suppose the option would have to be aware of quoting
outside the command so your example would work properly if zsh had a
compctl for -l after a -c option. I'm not sure how compctl -l deals
with quotes and -l doesn't seem to be working for me at the moment so I
can't test it.

I've made a couple of observations on differences between zsh and tcsh's
completion behaviour:
~ [68]% :> "a file"
~ [69]% less "a<tab>
tcsh completes to:
~ [69]% less "a file" _
whereas zsh completes to:
~ [69]% less "a file _
where the underscore is the cursor. I prefer tcsh's behaviour in this
case. Also, with the following:
~ [69]% less "a fi<tab>
tcsh completes as before but zsh treats us as being on the second word
so is completing files newly. I think zsh is being inconsistent as I
hope this will demonstrate:

compctl -x 'p[1]' -f - 'p[2]' -k '(a b c)' - 'p[3]' -k '(1 2 3)' -- t

While quotes are open, spaces within the quotes separate words:
~ [76]% t "a <tab>
a   b   c
~ [76]% t "a file <tab>
1   2   3
But when quotes are closed, a quoted area is all one word.
~ [76]% t "a file" <tab>
a   b   c
and backslash quoted spaces don't separate words
~ [76]% t a\ <tab>
~ [76]% t a\ file _
Note that single quotes behave in the same way as double quotes

It is difficult to say what the best thing to do is. I think zsh is
wrong because it is inconsistent but admit that it is more flexible than
tcsh because there is control of words within quotes. I don't think I've
needed this control in any of my compctls so would be in favour of
removing the inconsistency. Maybe what is needed is some way of
referencing words within quotes. e.g.
compctl -x 'p[1],qs[t]' -k '(1 2 3)' -- t
Where the q indicates that the pattern s[t] applies within the current
(quoted) word. I haven't had time to properly look at the new-style
completion yet but it might lend itself to a better solution.

> > Has any thought been given to implementing tcsh's complete=enhance
> This is what the matching control is for. In any recent enough zsh you 

fantastic thanks.

Seeing as there are no examples of matching control in compctl-examples
even though there are some in the documentation, I thought I'd
contribute my ncftp completion for it:

compctl -s '`sed -e 1,2d -e s/,.\*// < ~/.ncftp/bookmarks`' \
        -x 's[-]' -k '(a d C D f g G H L n p r R u V)' \
        - 'c[-1,-p]' -X 'Port number to dial' \
        - 'c[-1,-d]' -X 'Redial period (in seconds)' \
        - 'c[-1,-g]' -X 'No. of redials to give up after' \
        - 'c[-1,-n]' -X 'Max age of files to get (in days)' \
        - 'C[0,*.][0,*.*]' -s '`cut -d, -f2<~/.ncftp/bookmarks`' \
        -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -- ncftp

It completes host nicknames from the ncftp bookmark file unless there is
a '.' in the word in which case full hostnames are completed.
The matching is used to treat hostnames as case-insensitive because
they are and to allow the cunning stuff with '.'. It also completes the
options but you might want to cut that out, especially as this was
written for version 3 beta which has different options to 2.x.

Oliver Kiddle


             reply	other threads:[~1999-02-14 12:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-14 11:54 Oliver Kiddle [this message]
1999-02-14 21:26 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1999-02-15  9:51 Sven Wischnowsky
1999-02-08  9:12 Sven Wischnowsky
     [not found] <borsenkow.msk@sni.de>
1999-02-07 18:56 ` Oliver Kiddle

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=199902141154.LAA13108@Indigo.thoth.u-net.com \
    --to=opk@thoth.u-net.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).