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: > Hello everyone,
> 
> I'm having problems with zstyle. TO be perfectly honest, I've not
> managed to actually get it to do anthing, which means I have missed
> something.

Have you at least run compinit? (You need autoload -U compinit;compinit
in your .zshrc or run compinstall similarly from the command line). 

> I used to use:
> listsysctls () { set -A reply $(sysctl -AN ${1%.*}) }
> compctl -K listsysctls sysctl

There is already a pre-written completion for sysctl so this should
already work. If it didn't, you could do:

  _sysctl {
    compadd $(sysctl -AN ${1%.*})
  }
  compdef _sysctl sysctl

> ssh_common=( {,root@}mail.mynetwork.com {,root@}www.mynetwork.com )
> compctl -K ssh_common ssh scp

Here you need something like:
  zstyle ':completion:*:*:(ssh|scp):*:my-accounts' users-hosts \
    root@xxxxxxxxxxxxxxxxxx root@xxxxxxxxxxxxxxxxx

Again a completion for ssh has already been written so all the options
should be working. It looks up this style to find out your ssh
accounts.
 
> My basic problem is that an hour of staring at the man page, even
> with
> examples, has not helped in the slightest.

Peter has written a user-guide which has a good chapter on the new
completion system. You might find it easier than the manual. It is
available at http://zsh.sunsite.dk/Guide/zshguide.html

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