zsh-users
 help / color / mirror / code / Atom feed
* Can someone help me convert compctl to zstyle, please.
@ 2002-02-05  3:18 Rik
  2002-02-05 10:02 ` Oliver Kiddle
  0 siblings, 1 reply; 7+ messages in thread
From: Rik @ 2002-02-05  3:18 UTC (permalink / raw)
  To: zsh-users

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.

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

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

My basic problem is that an hour of staring at the man page, even with
examples, has not helped in the slightest.  I would appreciate it if
someone could help me translate this to the new compinit/zstyle style.

Thanks in advance,

rik
-- 
PGP Key: D2729A3F - Keyserver: wwwkeys.uk.pgp.net - rich at rdrose dot org
Key fingerprint = 5EB1 4C63 9FAD D87B 854C  3DED 1408 ED77 D272 9A3F
Public key also encoded with outguess on http://rikrose.net


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

* Re: Can someone help me convert compctl to zstyle, please.
  2002-02-05  3:18 Can someone help me convert compctl to zstyle, please Rik
@ 2002-02-05 10:02 ` Oliver Kiddle
  2002-02-05 10:38   ` Rik
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Kiddle @ 2002-02-05 10:02 UTC (permalink / raw)
  To: Rik; +Cc: zsh-users

 --- Rik <rik@pkl.net> 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@mail.mynetwork.com root@www.mynetwork.com

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


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

* Re: Can someone help me convert compctl to zstyle, please.
  2002-02-05 10:02 ` Oliver Kiddle
@ 2002-02-05 10:38   ` Rik
  2002-02-05 11:26     ` Oliver Kiddle
  0 siblings, 1 reply; 7+ messages in thread
From: Rik @ 2002-02-05 10:38 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-users

On Tue, Feb 05, 2002 at 10:02:09AM +0000, Oliver Kiddle wrote:
> Have you at least run compinit? (You need autoload -U compinit;compinit
> in your .zshrc or run compinstall similarly from the command line). 

Yes, I had.
 
> There is already a pre-written completion for sysctl so this should

I haven't got anything in my /usr/local/share/zsh/4.0.2/functions with
sysctl mentioned in it. I'll update to 4.0.4.

> already work. If it didn't, you could do:
> 
>   _sysctl {
>     compadd $(sysctl -AN ${1%.*})
>   }
>   compdef _sysctl sysctl

Sorry for the incredibly dumb-sounding question, but *where* would I do
that? I tested this it on the command line and in my ~/.zprofile, and
zsh sulked. If I changed the first line to "_sysctl () {" (tested on the
command line only, not that that should make a difference), then it
accepts it happily, but fails when I try to use it.
 
> Here you need something like:
>   zstyle ':completion:*:*:(ssh|scp):*:my-accounts' users-hosts \
>     root@mail.mynetwork.com root@www.mynetwork.com

Hm. Not quite the same as I had before, but close enough. I had got used
to a single tab though. 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.

> 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

Alas I was reading that yesterday too. I think I'm missing something
fundamental. When I work out what that is, I'm sure it will all make
sense.

-- 
PGP Key: D2729A3F - Keyserver: wwwkeys.uk.pgp.net - rich at rdrose dot org
Key fingerprint = 5EB1 4C63 9FAD D87B 854C  3DED 1408 ED77 D272 9A3F
Public key also encoded with outguess on http://rikrose.net


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

* Re: Can someone help me convert compctl to zstyle, please.
  2002-02-05 10:38   ` Rik
@ 2002-02-05 11:26     ` Oliver Kiddle
  2002-02-05 15:12       ` Rik
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Kiddle @ 2002-02-05 11:26 UTC (permalink / raw)
  To: Rik; +Cc: zsh-users

Rik <rik@pkl.net> 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@mail.mynetwork.com root@www.mynetwork.com
> 
> 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


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

* Re: Can someone help me convert compctl to zstyle, please.
  2002-02-05 11:26     ` Oliver Kiddle
@ 2002-02-05 15:12       ` Rik
  2002-02-12 17:07         ` Reading .zprofile (Re: Can someone help me convert ...) Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Rik @ 2002-02-05 15:12 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-users

On Tue, Feb 05, 2002 at 11:26:19AM +0000, Oliver Kiddle wrote:
> 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.

Aha. Completing from a list now understood. I bet the rest of it falls
into place now.
 
> It's an area of the new completion system that needs some reworking.

<nod> I've just used the arbitrary list completion, rather than the _ssh
function provided. I have the old behaviour back now, and I am happy.

Many thanks, Oliver

To the list:
There's one thing last thing I've just noticed. I was using ~/.zprofile
under 4.0.2. I upgraded to 4.0.4 and it decided to ignore ~/.zprofile.
Is there a reason for this? If it's compile specific, then additional
information is that I've just used a default install from FreeBSD ports.

rik
-- 
PGP Key: D2729A3F - Keyserver: wwwkeys.uk.pgp.net - rich at rdrose dot org
Key fingerprint = 5EB1 4C63 9FAD D87B 854C  3DED 1408 ED77 D272 9A3F
Public key also encoded with outguess on http://rikrose.net


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

* Reading .zprofile (Re: Can someone help me convert ...)
  2002-02-05 15:12       ` Rik
@ 2002-02-12 17:07         ` Bart Schaefer
  2002-02-12 21:25           ` Craig Van Tassle
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2002-02-12 17:07 UTC (permalink / raw)
  To: Rik; +Cc: zsh-users

On Feb 5,  3:12pm, Rik wrote:
}
} There's one thing last thing I've just noticed. I was using ~/.zprofile
} under 4.0.2. I upgraded to 4.0.4 and it decided to ignore ~/.zprofile.
} Is there a reason for this? If it's compile specific, then additional
} information is that I've just used a default install from FreeBSD ports.

There's no compile option to ignore only the .zprofile, so the question is
whether it's ignoring all your other startup files (.zshenv, .zshrc, etc.)
as well?  If the other files are working, then the only possibility is that
for some reason zsh does not believe that it is running as a login shell.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: Reading .zprofile (Re: Can someone help me convert ...)
  2002-02-12 17:07         ` Reading .zprofile (Re: Can someone help me convert ...) Bart Schaefer
@ 2002-02-12 21:25           ` Craig Van Tassle
  0 siblings, 0 replies; 7+ messages in thread
From: Craig Van Tassle @ 2002-02-12 21:25 UTC (permalink / raw)
  To: zsh

I though i was haveing that problem when i upgraded my zsh under FreeBSD.  One thing that i have done to make sure that all the files are loading up is i added a 
echo ".zshrc(or what ever) called".  Now ive gotten used to that and if i dont see it i know that something is broken.  Its also good for when im checking modifications to my .z files..
HTH
Craig
On Tue, Feb 12, 2002 at 05:07:20PM +0000, Bart Schaefer wrote:
> On Feb 5,  3:12pm, Rik wrote:
> }
> } There's one thing last thing I've just noticed. I was using ~/.zprofile
> } under 4.0.2. I upgraded to 4.0.4 and it decided to ignore ~/.zprofile.
> } Is there a reason for this? If it's compile specific, then additional
> } information is that I've just used a default install from FreeBSD ports.
> 
> There's no compile option to ignore only the .zprofile, so the question is
> whether it's ignoring all your other startup files (.zshenv, .zshrc, etc.)
> as well?  If the other files are working, then the only possibility is that
> for some reason zsh does not believe that it is running as a login shell.
> 
> -- 
> Bart Schaefer                                 Brass Lantern Enterprises
> http://www.well.com/user/barts              http://www.brasslantern.com
> 
> Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

end of thread, other threads:[~2002-02-12 21:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-05  3:18 Can someone help me convert compctl to zstyle, please Rik
2002-02-05 10:02 ` Oliver Kiddle
2002-02-05 10:38   ` Rik
2002-02-05 11:26     ` Oliver Kiddle
2002-02-05 15:12       ` Rik
2002-02-12 17:07         ` Reading .zprofile (Re: Can someone help me convert ...) Bart Schaefer
2002-02-12 21:25           ` Craig Van Tassle

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