Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can someone help me convert compctl to zstyle, please.



Rik <rik@xxxxxxx> wrote:

> Sorry for the incredibly dumb-sounding question, but *where* would I
> do
> that?

Probably after compinit in your .zshrc. Or from the command-line if you
are just testing it.

> zsh sulked. If I changed the first line to "_sysctl () {" (tested on

Sorry, my mistake. I'm stuck on a windows PC and couldn't test what I
was writing. You do need the () in the function definition as you
spotted. Also, the call to the sysctl command would need to be changed
to output all the sysctl variables. I didn't look closely at your
compctl function which references $1. The new system uses special
variables like $PREFIX instead.

Ignore the _sysctl example I gave you and try something simpler like:
  _f() { compadd one two three } ; compdef _f f
If that works, then you're not missing anything fundamental.

You can get the latest _sysctl from:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/zsh/zsh/Completion/Unix/Command/_sysctl?rev=1.4

> >   zstyle ':completion:*:*:(ssh|scp):*:my-accounts' users-hosts \
> >     root@xxxxxxxxxxxxxxxxxx root@xxxxxxxxxxxxxxxxx
> 
> Hm. Not quite the same as I had before, but close enough. I had got
> used
> to a single tab though.

It's an area of the new completion system that needs some reworking.

> Hrm. Is there a way to remove the /etc/hosts
> from the lists of hostnames to try. I'm guessing it's something to do
> with the tag-order thing, but, uhm, again, it appears not to like me.

You could try setting the hosts style which if set prevents the
/etc/hosts lookup. You may need a fairly specific context if you want
to keep /etc/hosts in other contexts (probably use the same context as
for users-hosts above after chopping `:my-accounts' off the end).
Typing Ctrl-X,h is useful for working out the right context.

There might be another, perhaps better way using tag-order but I'm not
too sure of details without first getting to a UNIX box.

Oliver

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com



Messages sorted by: Reverse Date, Date, Thread, Author