From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-users@sunsite.dk
Subject: Re: new completion modifications
Date: Thu, 22 Mar 2001 11:00:55 +0100 (MET) [thread overview]
Message-ID: <200103221000.LAA05184@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Scott Lipcon's message of Wed, 21 Mar 2001 22:58:41 -0500
Scott Lipcon wrote:
> I just upgraded from 3.0.x to a 3.1.9 version, and I'm starting to tweak the
> new completions to work the way I like. I have a few questions that I hope
> aren't too basic.
>
> Before, I had a few variables defined:
>
> $hosts=(commonly used hosts)
> $sshhosts=(hosts I ssh to)
> $pages=(a list of URLs I visit)
You certainly mean `hosts=(...)'. Written too much perl lately ? ;-)
> ...
>
> I've got this mostly working by simply doing:
>
> zstyle ':*' hosts $hosts
> zstyle ':*' hosts $sshhosts
The second call overrides the first one.
> First, which is the magic zstyle for a list of URLs? It seems that
> lynx/netscape use http:/(hosts)/ by default.
See the description of the `urls' tag and the `path' style in the
docs.
(I thought that were some script in the distribution helping to build
the directory structure the `path' style needs, but I can't find it
anymore.)
> Second, is there an easy way to limit my $hosts expansions to telnet, rlogin,
> ftp, etc, and $sshhosts to ssh, scp, etc? using the above zstyles, they are
> all thrown in one completion basket.
Lots. First, see the description of the `my-accounts' and
`other-accounts' tags and the `users-hosts' and `users-hosts-ports'
styles.
And then learn to make use of the first argument of `zstyle': it's a
pattern matching the context string in which the style should be used.
That string is described at the beginning of the `Completion System
Configuration' section. Inter alia it contains the name of the
current command, so you could use:
zstyle ':completion:*:*:ssh:*' hosts ...
to specify the host names to use for `ssh'. Or:
zstyle ':completion:*:*:(ssh|scp):*' hosts ...
for the hosts to use for both `ssh' and `scp'.
[see also Adam's message zsh-users:3692 ]
> Lastly, the default _rlogin completion file doesn't work for me - we use the
> kerberized version of rlogin, which takes the -x option:
>
> % rlogin host<tab>
>
> completes properly, as does rlogin -l user host<tab>.
>
> however,
>
> % rlogin -x host<tab>
>
> does nothing.
>
> How can I add the -x flag to the rlogin completion definition, without
> modifying the system file? (kerberized rlogin seems to have lots of other
> options that also aren't included - I only use -x however)
You can't without modifying the function. But it's *very* simple. At
the beginning of _rlogin you see:
_rlogin () {
case "$service" in
rlogin)
_arguments -s \
'-8[allow 8-Bit data]' \
'-e-[specify escape character]:escape character:' \
'-l[specify login user name]:login as:_rlogin_users' \
':remote host name:_rlogin_hosts'
;;
That part describes completion for `rlogin'. Now just stick a line
describing the `-x' option into it, e.g.:
_rlogin () {
case "$service" in
rlogin)
_arguments -s \
'-x[some kerberos thing]' \
... # the rest as in the original
Then put that modified function in your private zsh function directory
and make sure it is before the standard completion directories in your
$fpath. Then it will be automatically be used instead of the standard
one.
If you want to help us and others you could try to find a (secure)
test if the `rlogin' supports kerberos-specific options. If there is
such a test we could add it to the distributed _rlogin to make it
support these commands out-of-the-box.
To -workers: for some commands (including `rlogin', I think) we could
make the completion function more tolerant by adding `-A "-*"'s to the
calls to _arguments.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2001-03-22 10:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-22 10:00 Sven Wischnowsky [this message]
2001-03-22 15:34 ` Scott Lipcon
2001-03-22 16:01 ` Bart Schaefer
2001-03-22 16:28 ` Scott Lipcon
2001-03-22 21:08 ` Bart Schaefer
2001-03-22 21:50 ` Scott Lipcon
2001-03-23 16:09 ` Bart Schaefer
2001-03-23 16:27 ` Scott Lipcon
2001-03-23 17:14 ` Bart Schaefer
2001-03-23 18:37 ` Scott Lipcon
2001-03-23 18:54 ` Bart Schaefer
2001-03-23 20:16 ` Scott Lipcon
2001-03-24 17:22 ` Bart Schaefer
2001-03-22 16:58 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
2001-03-23 14:07 Sven Wischnowsky
2001-03-22 3:58 Scott Lipcon
2001-03-22 10:21 ` 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=200103221000.LAA05184@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-users@sunsite.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).