zsh-users
 help / color / mirror / code / Atom feed
* Re: wish for a colored completion system
@ 2000-06-08 10:41 Sven Wischnowsky
  0 siblings, 0 replies; 40+ messages in thread
From: Sven Wischnowsky @ 2000-06-08 10:41 UTC (permalink / raw)
  To: zsh-users


Bart Schaefer wrote:

> ...
> 
> So for example one can do
> 
> zstyle ':completion:*:zsh-options' \
> 	list-colors '=csh*=31:=*hist*=32:=list*=34:=*glob*=35'
> 
> ...
> 
> The tricky bit is figuring out what string goes at the tail of the style
> pattern, e.g. `zsh-options' in this case.  The place to look is the
> "Standard Tags" subsection in the "Completion System Configuration"
> chapter.

Or hit ^Xh (control-x h) and it will tell you (the `tags').


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: wish for a colored completion system
       [not found] <no.id>
@ 2000-06-08 14:31 ` Matthias Kopfermann
  2000-06-08 14:49   ` Sven Wischnowsky
  2000-06-08 14:50   ` Thomas Köhler
  2000-06-09 13:36 ` Matthias Kopfermann
                   ` (14 subsequent siblings)
  15 siblings, 2 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-08 14:31 UTC (permalink / raw)
  To: zsh-users

Okay, after having heard the answer that there is the possibility
to have colored completion, has anybody used it to create useful
completions with colors in them to share with us all?
There is not one example but the very easy to handle 
ZLS_COLOURS case for completing different kinds of files.
To me it still seems to be quite complex to say the least.

Okay, I try to be not so polite: :)
Should'nt there be an easier way than that approach?


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

* Re: wish for a colored completion system
@ 2000-06-08 14:49   ` Sven Wischnowsky
  0 siblings, 0 replies; 40+ messages in thread
From: Sven Wischnowsky @ 2000-06-08 14:49 UTC (permalink / raw)
  To: zsh-users


Matthias Kopfermann wrote:

> Okay, after having heard the answer that there is the possibility
> to have colored completion, has anybody used it to create useful
> completions with colors in them to share with us all?
> There is not one example but the very easy to handle 
> ZLS_COLOURS case for completing different kinds of files.
> To me it still seems to be quite complex to say the least.
> 
> Okay, I try to be not so polite: :)
> Should'nt there be an easier way than that approach?

It's the normal way of configuring things for the new completion
system and I definitely think colouring should be done like all other
setup for it. The `=pat=col' syntax was partly chosen because we
(well, some people here) wanted the possibility to use their $LS_COLOR
for zsh, too. That left us not too many syntax extensions to use.

Hm, how should we supply good examples for something depending so much 
on personal preference. One thing you can try is using similarities in 
the completion lists, like the ` -- ' thing used for descriptions:

  zstyle ':completion:*:(jobs|directory-stack|indexes|option|values)' list-colors \
      '=(#b)(*) -- (*)=35;1=31=33'

More examples? These show another problem: the patterns often depend
on the output format of certain system commands like ps(1) and lpq(1):

  zstyle ':completion:*:processes' list-colors \
      '=(#b)( #[0-9]#) ??????[^0-9]##([0-9]##:[0-9][0-9][.:][0-9][0-9])(*)=35=31;1=32=33'
  zstyle ':completion:*::lp*:jobs' list-colors \
      '=(#b)* [0-9] ##([^ 	]##) ##([^ 	]##) ##([^ 	]##) ##(*)=35=32=31;1=33=32'

And we can't do anything about that...

Other things one might want to highlight are the descriptions (see the 
`format' style) and probably `special' types of matches, like
`warnings', `all-expansions', `original' etc. Oh, and, of course, the
`ma' capability when using menu-selection.

Bye
 Sven

P.S.: You'll certainly get other colours because I don't use a
      colour-xterm.

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: wish for a colored completion system
  2000-06-08 14:31 ` wish for a colored completion system Matthias Kopfermann
  2000-06-08 14:49   ` Sven Wischnowsky
@ 2000-06-08 14:50   ` Thomas Köhler
  2000-06-08 15:11     ` Matthias Kopfermann
  1 sibling, 1 reply; 40+ messages in thread
From: Thomas Köhler @ 2000-06-08 14:50 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 2625 bytes --]

On Thu, Jun 08, 2000 at 04:34:37PM +0200,
Matthias Kopfermann <kopfermann@trio-hittfeld.de> wrote:
> 
> Okay, after having heard the answer that there is the possibility
> to have colored completion, has anybody used it to create useful
> completions with colors in them to share with us all?
> There is not one example but the very easy to handle 
> ZLS_COLOURS case for completing different kinds of files.
> To me it still seems to be quite complex to say the least.

Well... I have a bit of stuff for ssh, but not too much else:

setopt autolist
ZLS_COLOURS="no=36;40:fi=36;40:di=32;40:ln=36;40:pi=31;40:so=22;40:bd=44;37:cd=44;37:ex=35;40:mi=36;40:lc=\e[:rc=m:ec=:mi=37;41"
export ZLS_COLOURS
LS_COLORS=$ZLS_COLOURS
export LS_COLORS
ZLS_COLOURS="$ZLS_COLOURS:(hosts)=(#b)(*).(mayn.de)=36;40=31;40" # real fun
ZLS_COLOURS="$ZLS_COLOURS:(hosts)=*=33;40" # hostnames in yellow
ZLS_COLOURS="$ZLS_COLOURS:(users)=*=32;40" # users in green
export ZLS_COLOURS

#       no 0   for normal text  (i.e.  when  displaying  something
#              other than a matched file)
#       fi 0   for regular files
#       di 32  for directories
#       ln 36  for symbolic links
#       pi 31  for named pipes (FIFOs)
#       so 33  for sockets
#       bd 44;37
#              for block devices
#       cd 44;37
#              for character devices
#       ex 35  for executable files
#       mi none
#              for non-existent file (default is the value defined
#              for fi)
#       lc \e[ for the left code (see below)
#       rc m   for the right code
#       ec none
#              for the end code
autoload -U compinit
compinit
zstyle ':completion:*' completer '_complete' '_correct' '_approximate'

zmodload complist
# ( in my .zshrc, there are more hosts ;-)
zstyle '*'  hosts 'imbus.mayn.de' 'datenbus.mayn.de' 'willkuere.informatik.uni-wuerzburg.de' 'picard.franken.de'
zstyle '*'  users thomas tkoehler koehlert jean-luc root captain
zstyle ':completion:*' group-name ''


> Okay, I try to be not so polite: :)
> Should'nt there be an easier way than that approach?

Well - at first, it seems not too obvious that there are predefined
names for "normal file", "directory", "symbolic link" etc, but none for
things like "hostnames", "usernames" etc...

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* RE: wish for a colored completion system
@ 2000-06-08 15:11     ` Matthias Kopfermann
  2000-06-08 15:32       ` have to get used to the new zstyle thingy! Matthias Kopfermann
  0 siblings, 1 reply; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-08 15:11 UTC (permalink / raw)
  To: zsh-users

i guess, my problem is that `ZLS_COLORS' reminds me too much on
`ls'. It's perhaps only a matter of getting used to it.


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

* have to get used to the new zstyle thingy!
@ 2000-06-08 15:32       ` Matthias Kopfermann
       [not found]         ` <0FVU005MNF7Q6N@la-la.cambridgesiliconradio.com>
  0 siblings, 1 reply; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-08 15:32 UTC (permalink / raw)
  To: zsh-users

Ah, i guess, i thought, that ZLS_COLOURS had to have
all the entries for the new color completion to be avaiable.
That was my mistake. Okay, until yesterday i was a
3.1.6 user so i have to get used to many new things now that 
i have the 3.1.9.
So it is no design-error. It's just my difficulty to learn 
more in less time :)

Sorry for that!

Matthias, a very happy ZSH-user just lost in the world of
information.



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

* Re: wish for a colored completion system
       [not found]         ` <0FVU005MNF7Q6N@la-la.cambridgesiliconradio.com>
@ 2000-06-08 17:37           ` Bart Schaefer
  2000-06-08 18:44             ` Fletch
  0 siblings, 1 reply; 40+ messages in thread
From: Bart Schaefer @ 2000-06-08 17:37 UTC (permalink / raw)
  To: zsh-users, Matthias Kopfermann

Gee, it's hard to have these discussions when the rest of you are all
seven to nine hours ahead of me.

On Jun 8, 12:41pm, Sven Wischnowsky wrote:
} Subject: Re: wish for a colored completion system
}
} Bart Schaefer wrote:
} 
} > The tricky bit is figuring out what string goes at the tail of the style
} > pattern, e.g. `zsh-options' in this case.  The place to look is the
} > "Standard Tags" subsection in the "Completion System Configuration"
} > chapter.
} 
} Or hit ^Xh (control-x h) and it will tell you (the `tags').

Specifically, type the thing you want to complete after, then hit <C-x h>.

For some reason I was thinking the tags only showed up in the verbose
output, but it's the _styles_ that you can get with <ESC 2 C-x h>.

On Jun 8,  2:44pm, Matthias Kopfermann wrote:
}
}  the only problem with it, it is not simple nor is it obvious :(

You want simple, or you want programmable?

On Jun 8,  4:31pm, Matthias Kopfermann wrote:
}
} Okay, I try to be not so polite: :)
} Should'nt there be an easier way than that approach?

That approach was designed to make it easy to use your existing GNU "ls"
color options for coloring files in zsh.  Easy for one thing, hard for
some others.

On Jun 8,  4:49pm, Sven Wischnowsky wrote:
} 
} It's the normal way of configuring things for the new completion
} system and I definitely think colouring should be done like all other
} setup for it.

I think Matthias was referring to the colon-separated-list of attr=val
pairs where the val is a series of semicolon-seprated numbers, rather
than to the entire zstyle mechanism.  Though I admit contexts can look
a little daunting as well.

On Jun 8,  4:50pm, Thomas Köhler wrote:
}
} Well - at first, it seems not too obvious that there are predefined
} names for "normal file", "directory", "symbolic link" etc, but none for
} things like "hostnames", "usernames" etc...

That's just because GNU "ls" predefined the tokens for file types ahead
of us, and we borrowed them.  We wanted to use something less cryptic
(i.e., the group names in parens) for zsh competion "types."

On Jun 8,  5:11pm, Matthias Kopfermann wrote:
}
} i guess, my problem is that `ZLS_COLORS' reminds me too much on
} `ls'. It's perhaps only a matter of getting used to it.

I think you can see why it reminds you of "ls".

On Jun 8,  5:32pm, Matthias Kopfermann wrote:
}
} So it is no design-error. It's just my difficulty to learn 
} more in less time :)

Dogbert once said:
 Information is gushing toward your brain like a firehose aimed at a
 teacup.  Even the smartest among you has become "functionally stupid."

-- 
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] 40+ messages in thread

* Re: wish for a colored completion system
  2000-06-08 17:37           ` wish for a colored completion system Bart Schaefer
@ 2000-06-08 18:44             ` Fletch
       [not found]               ` <000608122524.ZM16857@candle.brasslantern.com>
  0 siblings, 1 reply; 40+ messages in thread
From: Fletch @ 2000-06-08 18:44 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

>>>>> "Bart" == Bart Schaefer <schaefer@candle.brasslantern.com> writes:

[...]

    Bart> Specifically, type the thing you want to complete after,
    Bart> then hit <C-x h>.

    Bart> For some reason I was thinking the tags only showed up in
    Bart> the verbose output, but it's the _styles_ that you can get
    Bart> with <ESC 2 C-x h>.

        OK, I'm trying to colourize hostnames for ssh.  So I type:

ssh l<Cx-h>

        And I get:

tags in context :completion::complete:ssh::
    argument-1 options  (_arguments _ssh _ssh)
tags in context :completion::complete:ssh:argument-1:
    hosts users  (_alternative _ssh _ssh) 
    hosts        (_hosts _combination _ssh_hosts _alternative _ssh _ssh) 
    users        (_users _combination _ssh_users _alternative _ssh _ssh)


        What tag should I use?  I've tried the following with no
success: 

zstyle ':completion:*:*:ssh:*:hosts' list-colors '=lemur*=01;32'
zstyle ':completion::complete:ssh:*:hosts' list-colors '=lemur*=01;32'
zstyle '*:hosts' list-colors '=lemur*=01;32'


        If I set something in ':completion:*' list-colors it works,
but I'm betting I'm just not understanding how styles are being
matched.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch@phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
678 443-6239(w)       |  scary questions." -- Jules                =(___)=
                      |                                               U


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

* Re: wish for a colored completion system
       [not found]                 ` <m2bt1c0xoe.fsf@godzilla.phydeaux.org>
@ 2000-06-08 20:07                   ` Bart Schaefer
  2000-06-08 20:18                     ` Fletch
  0 siblings, 1 reply; 40+ messages in thread
From: Bart Schaefer @ 2000-06-08 20:07 UTC (permalink / raw)
  To: Fletch; +Cc: zsh-users

On Jun 8,  3:39pm, Fletch wrote:
> 
>         If I add '=lemur*=01;32' to ':completion:*' list-colors it
> works fine (ssh l<C-d> produces three highighted lemur* and plain
> localhost and lp).  

Aha!  You have host names and user names listed simultaneously.

Add this:

zstyle ':completion:*' group-name ''

That will make two sub-lists, one of host names and one of user names,
and then you'll get the colors in the host names.

I'm not sure why ':completion:*:ssh:*' doesn't work for the combined
listing; perhaps it's a bug.  Sven?


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

* Re: wish for a colored completion system
  2000-06-08 20:07                   ` Bart Schaefer
@ 2000-06-08 20:18                     ` Fletch
  2000-06-08 20:36                       ` Peter Stephenson
  0 siblings, 1 reply; 40+ messages in thread
From: Fletch @ 2000-06-08 20:18 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

>>>>> "Bart" == Bart Schaefer <schaefer@candle.brasslantern.com> writes:

    Bart> On Jun 8, 3:39pm, Fletch wrote:
    >>  If I add '=lemur*=01;32' to ':completion:*' list-colors it
    >> works fine (ssh l<C-d> produces three highighted lemur* and
    >> plain localhost and lp).

    Bart> Aha!  You have host names and user names listed
    Bart> simultaneously.

    Bart> Add this:

    Bart> zstyle ':completion:*' group-name ''

    Bart> That will make two sub-lists, one of host names and one of
    Bart> user names, and then you'll get the colors in the host
    Bart> names.

        That indeed fixes it.  Perhaps there should be a compinstall
option under `display and insertion options' to toggle this behavior
(or maybe make it set by default)?

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch@phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
678 443-6239(w)       |  scary questions." -- Jules                =(___)=
                      |                                               U


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

* Re: wish for a colored completion system
  2000-06-08 20:18                     ` Fletch
@ 2000-06-08 20:36                       ` Peter Stephenson
  0 siblings, 0 replies; 40+ messages in thread
From: Peter Stephenson @ 2000-06-08 20:36 UTC (permalink / raw)
  To: zsh-users

Fletch wrote:
>     Bart> zstyle ':completion:*' group-name ''
> 
>         That indeed fixes it.  Perhaps there should be a compinstall
> option under `display and insertion options' to toggle this behavior
> (or maybe make it set by default)?

There is, pick the first item,

1.  Change appearance of completion lists:  allows descriptions of
    completions to appear, sorting of different types of completions,
    and scrolling of completion lists.

and the second option the next menu,

2.  Make different types of completion appear in separate lists.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@CambridgeSiliconRadio.com
Web: http://www.pwstephenson.fsnet.co.uk


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

* Re: wish for a colored completion system
       [not found] <no.id>
  2000-06-08 14:31 ` wish for a colored completion system Matthias Kopfermann
@ 2000-06-09 13:36 ` Matthias Kopfermann
  2000-06-14 13:43 ` Fun zsh trick for today Matthias Kopfermann
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-09 13:36 UTC (permalink / raw)
  To: Bart Schaefer

> On Jun 8,  2:44pm, Matthias Kopfermann wrote:
> }
> }  the only problem with it, it is not simple nor is it obvious :(
> 
> You want simple, or you want programmable?
hmm, that is one of the more difficult questions to ask.
I guess, I would like medium programmability. :)
Reminds me on something:
i love vim but i had to get used to the color-programming, in
elvis (another vi-clone) it was much, much simpler but not at all
powerful.
I guess: I would very much like the shell to train me in doing it
manually so when i know i can do the programming much quicker.
Something like a interactive tutorial.
You know , like for vi or emacs.
(" Now try to get the colors right.
First: What command do you want to be completed? ...")
Or: What about a nice Gui-Interface (tcsh has it for
completion) or a dialog-script that helps me do a whole set of
completion-algorithms? I would be very satisfied, because it
would reduce my steep learning curve.
reading -> translating ( in my case ) -> understanding ->
programming.
Sometimes i think the
getting-used-to-it takes longer than the whole effect of
usibility  (but that may be my problem only because i -hate to
say it - i am slooow!.)
> 
> That approach was designed to make it easy to use your existing GNU "ls"
> color options for coloring files in zsh.  Easy for one thing,
and that IS easy, right!
> hard for
> some others.
At first I thought, the approach was not general enough. but then again:
The more general the more complicated , it seems.
Handcoding is great if knowledge is there. But in my case it
would dramatically increase my knowledge if there was a tool to
help me get it right and be trained and then i could study the whole output and
do the whole thing manually much quicker.
I love to be able to do it manually. And i really love to be able
to work with unix ( linux in my happy case ) 
_without_ using graphical interfaces, really. 
But normally all these powerful tools don't come with easy to
follow instructions how to make it work.
Peter Stephenson has done many very good attempts to change that
with his userguide and I said before that i consider this to be
very, very important and applauded him.

To make a long explanation of my state short:
I would love to have a training tool (software) for many of the wonderful
free software-products and almost nothing is available.
So it takes time. In my case much time that i love to spent but
sometimes i just get frustrated because it takes soo long.

okay, I revealed myself. Many things are personal but i know many
people that feel the same. 
And , because Bart asked , i took the chance to explain it.
Of course this is not at all ZSH-specifig. 
Is it off-topic?

Matthias


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

* Re: Fun zsh trick for today
       [not found] <no.id>
  2000-06-08 14:31 ` wish for a colored completion system Matthias Kopfermann
  2000-06-09 13:36 ` Matthias Kopfermann
@ 2000-06-14 13:43 ` Matthias Kopfermann
  2000-06-14 13:57   ` Clint Adams
  2000-06-14 15:33 ` Matthias Kopfermann
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-14 13:43 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Sat, Jun 10, 2000 at 10:50:51PM +0000, Bart Schaefer wrote:
>[ ... amazing information deleted ]

i think, this would be a great feature of the mailinglist, if
bart or sven or some other guru would give such nice tricks once
a week or something.
it makes happy user, at least it made me happy :)

Matthias


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

* Re: Fun zsh trick for today
  2000-06-14 13:43 ` Fun zsh trick for today Matthias Kopfermann
@ 2000-06-14 13:57   ` Clint Adams
  2000-06-14 14:09     ` Ollivier Robert
  2000-06-14 14:15     ` Peter Stephenson
  0 siblings, 2 replies; 40+ messages in thread
From: Clint Adams @ 2000-06-14 13:57 UTC (permalink / raw)
  To: Matthias Kopfermann; +Cc: Bart Schaefer, zsh-users

> i think, this would be a great feature of the mailinglist, if
> bart or sven or some other guru would give such nice tricks once
> a week or something.
> it makes happy user, at least it made me happy :)

I'm no Bart-guru, but here's an application of his trick that I find useful
for the new completion system:

zmodload -i zsh/mapfile
hosts=(${(@)${(@)${(M)${(f)mapfile[$HOME/.ssh/known_hosts]}:#[^0-9]*}%%\ *}%%,*})
zstyle ':completion:*:hosts' hosts $hosts


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

* Re: Fun zsh trick for today
  2000-06-14 13:57   ` Clint Adams
@ 2000-06-14 14:09     ` Ollivier Robert
  2000-06-14 15:02       ` Fletch
  2000-06-14 14:15     ` Peter Stephenson
  1 sibling, 1 reply; 40+ messages in thread
From: Ollivier Robert @ 2000-06-14 14:09 UTC (permalink / raw)
  To: zsh-users

According to Clint Adams:
> zmodload -i zsh/mapfile
> hosts=(${(@)${(@)${(M)${(f)mapfile[$HOME/.ssh/known_hosts]}:#[^0-9]*}%%\ *}%%,*})

<humour>
I'm beginning to see zsh turning up into perl-sh... :-)
</humour>
-- 
Ollivier ROBERT -=- Eurocontrol EEC/TEC -=- roberto@eurocontrol.fr
The Postman hits! The Postman hits! You have new mail.


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

* Re: Fun zsh trick for today
  2000-06-14 13:57   ` Clint Adams
  2000-06-14 14:09     ` Ollivier Robert
@ 2000-06-14 14:15     ` Peter Stephenson
  2000-06-14 14:21       ` Peter Stephenson
                         ` (2 more replies)
  1 sibling, 3 replies; 40+ messages in thread
From: Peter Stephenson @ 2000-06-14 14:15 UTC (permalink / raw)
  To: Zsh users list

> I'm no Bart-guru, but here's an application of his trick that I find useful
> for the new completion system:
> 
> zmodload -i zsh/mapfile
> hosts=(${(@)${(@)${(M)${(f)mapfile[$HOME/.ssh/known_hosts]}:#[^0-9]*}%%\ *}%%
> ,*})
> zstyle ':completion:*:hosts' hosts $hosts

In something like this there's really no gain over doing it using more
ordinary zsh methods, i.e. with $(<...), which doesn't require a module.
Plus you don't need all those (@)'s once parameter substitution already has
arrays, which (f) provides.  The only trick here is using double quotes to
get whole lines for splitting.  I think the following should work in 3.0.8
(can't quite remember if the trick of putting double quotes in the middle
made its way back --- if not, put quotes around the lot and put (@)'s at
the front of all the parameter substitutions).

hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[^0-9]*}%%\ *}%%,*
})

or

hosts=("${(@)${(@)${(@M)${(@f)"$(<$HOME/.ssh/known_hosts)"}:#[^0-9]*}%%\ *}%%,*
}")

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: Fun zsh trick for today
  2000-06-14 14:15     ` Peter Stephenson
@ 2000-06-14 14:21       ` Peter Stephenson
  2000-06-14 14:27       ` Clint Adams
  2000-06-14 14:37       ` Bart Schaefer
  2 siblings, 0 replies; 40+ messages in thread
From: Peter Stephenson @ 2000-06-14 14:21 UTC (permalink / raw)
  To: Zsh users list

I wrote:
> or
> 
> hosts=("${(@)${(@)${(@M)${(@f)"$(<$HOME/.ssh/known_hosts)"}:#[^0-9]*}%%\ *}%%
> ,*
> }")
                                ^                          ^
erk, sorry, remove the double quotes in the middle in this case.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: Fun zsh trick for today
  2000-06-14 14:15     ` Peter Stephenson
  2000-06-14 14:21       ` Peter Stephenson
@ 2000-06-14 14:27       ` Clint Adams
  2000-06-14 14:37       ` Bart Schaefer
  2 siblings, 0 replies; 40+ messages in thread
From: Clint Adams @ 2000-06-14 14:27 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

> hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[^0-9]*}%%\ *}%%,*})

This has the opposite effect as desired (i.e., it returns an array
containing only those entries beginning with digits).  This does what I
want (except for omitting things like 3stop.com):

hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*})


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

* Re: Fun zsh trick for today
  2000-06-14 14:15     ` Peter Stephenson
  2000-06-14 14:21       ` Peter Stephenson
  2000-06-14 14:27       ` Clint Adams
@ 2000-06-14 14:37       ` Bart Schaefer
  2 siblings, 0 replies; 40+ messages in thread
From: Bart Schaefer @ 2000-06-14 14:37 UTC (permalink / raw)
  To: Peter Stephenson, Zsh users list

On Jun 14,  3:15pm, Peter Stephenson wrote:
} Subject: Re: Fun zsh trick for today
}
} Plus you don't need all those (@)'s once parameter substitution already has
} arrays, which (f) provides.  The only trick here is using double quotes to
} get whole lines for splitting.  I think the following should work in 3.0.8
} (can't quite remember if the trick of putting double quotes in the middle
} made its way back

The quotes in the middle is in 3.0.7, as part of the "minimal forwards
compatibility" effort.

There is a small bug with them in both versions, though; you can't take
the length of the quoted part:

zagzig[57] echo ${#"${(f)$(<file)}"}
zsh: bad substitution
zagzig[60] echo ${#${"${(f)$(<ChangeLog)}"}}
8017

It works with ${=...} and ${~...}, but not with ${#...}.

-- 
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] 40+ messages in thread

* Re: Fun zsh trick for today
  2000-06-14 14:09     ` Ollivier Robert
@ 2000-06-14 15:02       ` Fletch
  0 siblings, 0 replies; 40+ messages in thread
From: Fletch @ 2000-06-14 15:02 UTC (permalink / raw)
  To: Ollivier Robert; +Cc: zsh-users

>>>>> "Ollivier" == Ollivier Robert <roberto@eurocontrol.fr> writes:

    Ollivier> According to Clint Adams:
    >> zmodload -i zsh/mapfile
    >> hosts=(${(@)${(@)${(M)${(f)mapfile[$HOME/.ssh/known_hosts]}:#[^0-9]*}%%\
    >> *}%%,*})

    Ollivier> <humour> I'm beginning to see zsh turning up into
    Ollivier> perl-sh... :-) </humour> 


        Well, I've got a patch off of 3.1.6 that embeds a perl
interpreter as a loadable module and let's you call perl subroutines
as zsh functions . . . :)

        I really need to update it work with 3.1.9, though.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch@phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
678 443-6239(w)       |  scary questions." -- Jules                =(___)=
                      |                                               U


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

* Re: Fun zsh trick for today
       [not found] <no.id>
                   ` (2 preceding siblings ...)
  2000-06-14 13:43 ` Fun zsh trick for today Matthias Kopfermann
@ 2000-06-14 15:33 ` Matthias Kopfermann
  2000-06-14 15:52   ` Peter Stephenson
  2000-06-14 16:31 ` Matthias Kopfermann
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-14 15:33 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

> 
> hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[^0-9]*}%%\ *}%%,*
> })
hu %) Could someone explain these hieroglyphs for a simple soul
like me? %%)


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

* Re: Fun zsh trick for today
  2000-06-14 15:33 ` Matthias Kopfermann
@ 2000-06-14 15:52   ` Peter Stephenson
  0 siblings, 0 replies; 40+ messages in thread
From: Peter Stephenson @ 2000-06-14 15:52 UTC (permalink / raw)
  To: Zsh users list

> > 
> > hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[^0-9]*}%%\ *}%%,*
> > })
> hu %) Could someone explain these hieroglyphs for a simple soul
> like me? %%)

that's why this is deferred till (the unwritten) chapter 5 of the user
guide, instead of the chapter on basic syntax...

$(<$HOME/.ssh/known_hosts)

is a standard substitution: it simply takes the file and sticks it onto the
command line at that point.

"$(<$HOME/.ssh/known_hosts)"

Now it's quoted, it doesn't do word splitting; we have the complete file as
one word.  From now on, we do nested substitutions: you just have to
remember that ${${...}}, or ${${...}}, essentially does nothing but an
ordinary parameter expansion --- the whole point is the extra bits tacked
on with each extra set of braces.  For example, we're now going to do

${(f)"$(<$HOME/.ssh/known_hosts)"}

so we get the same answer, but with the effect of putting the (f) flag at
the start, which splits the result of that into lines.  So we now have the
entire file as an array, one line per element.

${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}

(Clint says the ^ shouldn't be there) says take the array elements (= lines
of the original file) which completely match [0-9]*, i.e. elements
beginning with a digit, and remove them, which is what ${...:#...} is for.

${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}

takes the result of that, and strips off from the end the largest pattern
matching ' *', i.e. a space followed by anything else, in other words it
leaves the largest initial string with no whitespace, which is a hostname
(this is a standard ${...%%...} which even ordinary shells do, although not
nested).

${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}

does another strip at the end, this time for everything from the first
comma on.  If there wasn't a comma, nothing changes.  You could have
combined the last two as ${...%%[[:blank:],]*}, or something.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: Fun zsh trick for today
       [not found] <no.id>
                   ` (3 preceding siblings ...)
  2000-06-14 15:33 ` Matthias Kopfermann
@ 2000-06-14 16:31 ` Matthias Kopfermann
  2000-06-26 10:23 ` (forw) --help able programs and completion Matthias Kopfermann
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-14 16:31 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

On Wed, Jun 14, 2000 at 04:52:10PM +0100, Peter Stephenson wrote:
>  [ ..] #deleted for saving space 

Thanks, peter! That's what i needed to follow.
Nesting makes me quite dizzy but that may be better after some
decades :)


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

* Re: (forw) --help able programs and completion
       [not found] <no.id>
                   ` (4 preceding siblings ...)
  2000-06-14 16:31 ` Matthias Kopfermann
@ 2000-06-26 10:23 ` Matthias Kopfermann
  2000-06-26 10:30 ` Matthias Kopfermann
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-26 10:23 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

On Mon, Jun 26, 2000 at 11:20:20AM +0100, Peter Stephenson wrote:
> not quite sure who's forwarding what to whom here...
I am sorry, I was blind so I made the mistake of sending to the
wrong address :)

Matthias


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

* Re: (forw) --help able programs and completion
       [not found] <no.id>
                   ` (5 preceding siblings ...)
  2000-06-26 10:23 ` (forw) --help able programs and completion Matthias Kopfermann
@ 2000-06-26 10:30 ` Matthias Kopfermann
  2000-06-29 11:41 ` is the reference card for zsh still 3.0 ? Matthias Kopfermann
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-26 10:30 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

On Mon, Jun 26, 2000 at 11:20:20AM +0100, Peter Stephenson wrote:
> Use compinstall.  I would like feedback, but the format is restricted by
> the fact that it will be written in zsh, so there are menus but no dialogue
> boxes.
Which is really an approach in the right direction. Now my
question is: Where do i find the `--help' completion here?

-- 
And in the end the love you take 
is equal to the love you make
THE BEATLES


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

* Re: is the reference card for zsh still 3.0 ?
       [not found] <no.id>
                   ` (6 preceding siblings ...)
  2000-06-26 10:30 ` Matthias Kopfermann
@ 2000-06-29 11:41 ` Matthias Kopfermann
  2000-07-05 10:47 ` Matthias Kopfermann: Re: coloring of --help completion possible? Matthias Kopfermann
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-06-29 11:41 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

On Thu, Jun 29, 2000 at 12:27:02PM +0100, Peter Stephenson wrote:
> 
> I haven't updated it because it was a lot of work (mostly doing the
> formatting, assembling the info wasn't so hard) and I didn't get a lot of
> messages like this one; it's going back a long time now.  This has at least
> prompted me to recover it in case the old web site goes; I should move it
> to sunsite.auc.dk.
it is at least better than nothing. I took the `mpage -dp'
approach and so was able to reduce the size so it nearly was a
card again. A big one, but what does one expect of a ZSH
reference card ? :)
> Calling it a `card' is probably a breach of the Trades Desriptions Act.
> It's six pages as it is and it's not going to get any shorter.
But consider your marvelous user guide and it's _hundreds_ of pages
when it will be finished. THATS the difference. 
When I consider that and the big, big manual pages which have
20878 lines I guess there is no other chance for an overview.
Okay they have lots of "\n" inside.
 `man zshall | col -b | tr -s "\n" | wc -l' gets me : 14576
 (Is there anybody that loves to do tr -s "\n" in this case? :) )

So i guess it remains to be _necessary_ even if it is no guide.

Matthias

-- 
And in the end the love you take 
is equal to the love you make
THE BEATLES


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

* Re: Matthias Kopfermann: Re: coloring of --help completion possible?
       [not found] <no.id>
                   ` (7 preceding siblings ...)
  2000-06-29 11:41 ` is the reference card for zsh still 3.0 ? Matthias Kopfermann
@ 2000-07-05 10:47 ` Matthias Kopfermann
  2000-07-17 13:39 ` wanted: viins-mode and digit argument with a,i,A and such Matthias Kopfermann
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-07-05 10:47 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

On Wed, Jul 05, 2000 at 04:52:17AM +0000, Bart Schaefer wrote:
> On Jul 4,  6:17pm, Peter Stephenson wrote:
> }
> } I'm sure Someone knows about this.
oops, me in the subject? what an honor :)
> 
> A second problem is that `l*' and `v*' won't match the name of any
> option.  Options all start with `-', and only options that start with
> `--' are completed by _use_lo, so you probably meant to say
> 
>     zstyle '*:options' list-colors '=--l*=34:=--v*=35'
> 
> Do either of those answers fix things up?
instantly :) hurra, that is what makes free software-use such a
pleasure. it works :) fine, over and out :)

Matthias


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

* Re: wanted: viins-mode and digit argument with a,i,A and such
       [not found] <no.id>
                   ` (8 preceding siblings ...)
  2000-07-05 10:47 ` Matthias Kopfermann: Re: coloring of --help completion possible? Matthias Kopfermann
@ 2000-07-17 13:39 ` Matthias Kopfermann
  2000-07-17 14:06   ` Peter Stephenson
  2000-07-21 10:42 ` completion for GNU color ls, anyone? Matthias Kopfermann
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Matthias Kopfermann @ 2000-07-17 13:39 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh users list

On Mon, Jul 17, 2000 at 02:02:21PM +0100, Peter Stephenson wrote:
> I just couldn't be bothered to do
> it the long-winded way.
Yes, that is why i stopped doing it. It is not that important, on
the other hand this really is typical vi-behavior, so it would be
cool, if it was with the standard ZSH.
"Look here, ZSH alone does it right, bash and tcsh can't " :)

Matthias


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

* Re: wanted: viins-mode and digit argument with a,i,A and such
  2000-07-17 13:39 ` wanted: viins-mode and digit argument with a,i,A and such Matthias Kopfermann
@ 2000-07-17 14:06   ` Peter Stephenson
  0 siblings, 0 replies; 40+ messages in thread
From: Peter Stephenson @ 2000-07-17 14:06 UTC (permalink / raw)
  To: Zsh users list

> On Mon, Jul 17, 2000 at 02:02:21PM +0100, Peter Stephenson wrote:
> > I just couldn't be bothered to do
> > it the long-winded way.
> Yes, that is why i stopped doing it.

If it can be done in a widget, it probably should be.  The function
interface in 3.1 is now powerful enough that you need a very good reason
for adding something to the basic shell.  We can easily add new zle widget
functions to the distribution which are essentially indistinguishable from
hard-coded functions but don't add to the shell and can be modified.  One
day they may be made more easily configurable along the lines of the new
completion system.

By the way, I said you couldn't do a minibuffer read, but using `zle -R
string...' you can make it look as if you can.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: completion for GNU color ls, anyone?
       [not found] <no.id>
                   ` (9 preceding siblings ...)
  2000-07-17 13:39 ` wanted: viins-mode and digit argument with a,i,A and such Matthias Kopfermann
@ 2000-07-21 10:42 ` Matthias Kopfermann
  2000-07-21 15:17   ` Adam Spiers
  2000-07-21 10:58 ` Matthias Kopfermann
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Matthias Kopfermann @ 2000-07-21 10:42 UTC (permalink / raw)
  To: Francis Galiegue; +Cc: Matthias Kopfermann, zsh mailinglist

On Fri, Jul 21, 2000 at 11:18:11AM +0200, Francis Galiegue wrote:
> On Thu, 20 Jul 2000, Matthias Kopfermann wrote:
> 
> 
> You can just export ZLS_COLORS=$LS_COLORS in your .zshrc or anywhere else, or
> did I completely misunderstand your question?
yes, completely :)
I really want the gnu-linux versions of as many commands as i can
get. This ZLS_COLORS trick is known to me :)
as zsh is not for GNU only (which is good), it does not provide
enough completions for GNU commands.
ls , screen , perl (well sort of GNU :)), emacs completions, vim
and many others are missing. (of course, no ZSH distribution can
have all these commands, that would take 1000's of hours to do
them all, i guess.)

Do we have a place to collect the completions of GNU commands?
That would be cool, I am quite sure.


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

* Re: completion for GNU color ls, anyone?
       [not found] <no.id>
                   ` (10 preceding siblings ...)
  2000-07-21 10:42 ` completion for GNU color ls, anyone? Matthias Kopfermann
@ 2000-07-21 10:58 ` Matthias Kopfermann
  2000-07-21 15:54   ` Bart Schaefer
  2000-07-21 16:00 ` Matthias Kopfermann
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Matthias Kopfermann @ 2000-07-21 10:58 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users

On Fri, Jul 21, 2000 at 12:55:39PM +0200, Sven Wischnowsky wrote:
> But seriously, we already have completion functions for GNU commands
> and if people write new ones and send them to us they will be reviewed 
> and shipped with future versions.
 i know and i am quite happy with many completions. And don't get
 me wrong. I am trying to learn how to do them myself. Perhaps i
 should send my versions and ask questions to understand the
 completion system better. But i am feeling like a Silliest
 Possible User already :)
> The same for non-GNU commands,
> obviously.
I hope so, too.
> So, if anyone has anything interesting...
And what about the ability to have a special site for fg. Linux.
Would that make some sense? I mean i guess that many people would
love a site like that. And that should not be the goal of a
ZSH-distribution to ship with as many completions for Linux as
possible. So perhaps a site dedicated would be cool.
The gurus could then judge what should be included with ZSH
itself. Just an idea for discussion.

Matthias


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

* Re: completion for GNU color ls, anyone?
  2000-07-21 10:42 ` completion for GNU color ls, anyone? Matthias Kopfermann
@ 2000-07-21 15:17   ` Adam Spiers
  0 siblings, 0 replies; 40+ messages in thread
From: Adam Spiers @ 2000-07-21 15:17 UTC (permalink / raw)
  To: zsh mailinglist

Matthias Kopfermann (kopfermann@trio-hittfeld.de) wrote:
> I really want the gnu-linux versions of as many commands as i can
> get. This ZLS_COLORS trick is known to me :)
> as zsh is not for GNU only (which is good), it does not provide
> enough completions for GNU commands.
> ls , screen , perl (well sort of GNU :)), emacs completions, vim
> and many others are missing.

Completions for perl are not missing.  Have you tried a recent
development release?

I might get round to doing screen and emacs soon.  I'm not a vim user
so I won't do that.  ls ... well, that's a different issue.  The
options for ls vary massively over the different systems, so we
probably will need to have a restructuring of the Completion subtree
before this gets completion code.

> (of course, no ZSH distribution can have all these commands, that
> would take 1000's of hours to do them all, i guess.)

Don't underestimate us :-)   We have a completion set which is pretty
impressive complete already ...


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

* Re: completion for GNU color ls, anyone?
  2000-07-21 10:58 ` Matthias Kopfermann
@ 2000-07-21 15:54   ` Bart Schaefer
  0 siblings, 0 replies; 40+ messages in thread
From: Bart Schaefer @ 2000-07-21 15:54 UTC (permalink / raw)
  To: Matthias Kopfermann; +Cc: zsh-users

I've created a patch category on the sourceforge.net zsh project for the
submission of new completion functions.

    http://sourceforge.net/patch/?group_id=4068&_category=10305

Subscribers to zsh-workers of course can continue to send new functions
to the list, but we can use sourceforge as a "drop zone" for other new
completions and direct people there (via the FAQ and META-FAQ, perhaps,
but more likely via link on zsh.org) to obtain functions that either are
not in the distribution yet or are too system-specific for inclusion in
the general distribution.

-- 
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] 40+ messages in thread

* Re: completion for GNU color ls, anyone?
       [not found] <no.id>
                   ` (11 preceding siblings ...)
  2000-07-21 10:58 ` Matthias Kopfermann
@ 2000-07-21 16:00 ` Matthias Kopfermann
  2000-07-26 16:24 ` how can one let completion work *inside* zsh scripts? Matthias Kopfermann
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-07-21 16:00 UTC (permalink / raw)
  To: Adam Spiers; +Cc: zsh mailinglist

setterm would be cool, too. there are 100 's. xterm would be cool
but i guess, i should look into a dev-version. it might already
be there :)


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

* Re: how can one let completion work *inside* zsh scripts?
       [not found] <no.id>
                   ` (12 preceding siblings ...)
  2000-07-21 16:00 ` Matthias Kopfermann
@ 2000-07-26 16:24 ` Matthias Kopfermann
  2000-07-27 12:42 ` Matthias Kopfermann
  2000-08-01 15:34 ` Matthias Kopfermann
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-07-26 16:24 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users

On Wed, Jul 26, 2000 at 02:00:11PM +0200, Sven Wischnowsky wrote:
> 
> Then... do you really need a *script*? Or would a function do?
no, as long as it is interactive i don't care. But i was not
thinking of filename completion, more of the ability to let users
easily choose options whatever. Another way is select of course
but i always wanted to know how to be able to do it with little
zsh scripts, too. 
>. If you need something else
> than filename completion, the `offical' way to do that is to (locally)
> define the parameter compcontex and set it to the name of the
> completion context that should be used for completion.
this was new to me. Thanx for explaining!

Matthias





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

* Re: how can one let completion work *inside* zsh scripts?
       [not found] <no.id>
                   ` (13 preceding siblings ...)
  2000-07-26 16:24 ` how can one let completion work *inside* zsh scripts? Matthias Kopfermann
@ 2000-07-27 12:42 ` Matthias Kopfermann
  2000-08-01 15:34 ` Matthias Kopfermann
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-07-27 12:42 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users

> To zsh-workers (and everyone else interested): hm, is this becoming
> FAQish enough to make is simplify it? For example we could allow
> compcontext to be set to `foo()' to make it just call function
> `foo'. And we could allow it to be set to an array and then make
> completion offer its elements as possible completions.
I am for it ! The easier the better. At least normally I
tend to think that way.

Matthias


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

* Re: how can one let completion work *inside* zsh scripts?
       [not found] <no.id>
                   ` (14 preceding siblings ...)
  2000-07-27 12:42 ` Matthias Kopfermann
@ 2000-08-01 15:34 ` Matthias Kopfermann
  15 siblings, 0 replies; 40+ messages in thread
From: Matthias Kopfermann @ 2000-08-01 15:34 UTC (permalink / raw)
  To: Sven Wischnowsky; +Cc: zsh-users

On Thu, Jul 27, 2000 at 03:21:07PM +0200, Sven Wischnowsky wrote:
> 
> But that almost suggest (at least to me, striving for consistency) to
> put everything into a string of the form `<descr>:<action>', where
> <action> is as in _arguments, i.e.:
> 
>   {...}               = evaluate `...'
>   (1 2)               = complete `1' and `2'
>   (( 1\:foo 2\:bar )) = complete `1' and `2' and describe them as
>                         `foo' and `bar' in the list
> 
> Hm, is this going too far? Or should we use the array-based solution
> and allow to give the description with another parameter?
it could be me alone, but i guess that arrays for one and then
parameters with another description would be nice.
perhaps because it is easier for the eye. have problems to have a
series of ::: after each other. (my biggest problem with the new
completion system. thats like using FPATH instead of fpath, i
like the new way that ZSH solves the problem of pathes with an
array. it's not the same here but it still is full of words.)
> Or should we just support compcontext-as-array without (a)
> description(s) (and the `func()' form) and let user's use functions if 
> they need descriptions?
hmm, what do the others think?


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

* Re: (forw) --help able programs and completion
@ 2000-06-26 10:45 Sven Wischnowsky
  0 siblings, 0 replies; 40+ messages in thread
From: Sven Wischnowsky @ 2000-06-26 10:45 UTC (permalink / raw)
  To: zsh-users


Matthias Kopfermann wrote:

> On Mon, Jun 26, 2000 at 11:20:20AM +0100, Peter Stephenson wrote:
> > Use compinstall.  I would like feedback, but the format is restricted by
> > the fact that it will be written in zsh, so there are menus but no dialogue
> > boxes.
> Which is really an approach in the right direction. Now my
> question is: Where do i find the `--help' completion here?

Nowhere. compinstall is about configuration with styles (mostly).

What you need is to tell the completion system to use a certain
function to complete after the commands in question. That's done with
`compdef':

 compdef <func-to-call> <commands...>

We have a function to complete the options described by the `--help'
output, it's called `_use_lo', so, once you have identified all the
commands for which completion should call the command with `--help'
and complete the options, you can do:

  compdef _use_lo cmd1 cmd2 cmd3 ...

In normal setup, _use_lo is only used for `gls' because we have to be
careful. Not every Unix supports `--help' for (almost) every command
and to complete the options, we have to call the command which may be
dangerous if it doesn't understand `--help', obviously.


To -workers (and to anyone who wants to use the above): it seems
_use_lo wasn't updated for quite some time, the  patch below should
make it more user-friendly.


Bye
 Sven

Index: Completion/User/_use_lo
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_use_lo,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 _use_lo
--- Completion/User/_use_lo	2000/03/11 00:05:30	1.1.1.6
+++ Completion/User/_use_lo	2000/06/26 10:41:34
@@ -3,4 +3,4 @@
 # This is for GNU-like commands which understand the --help option,
 # but which do not otherwise require special completion handling.
 
-_arguments -- || _default
+_arguments '*:arg: _default' --

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: (forw) --help able programs and completion
  2000-06-26 10:14 Roland Jesse
@ 2000-06-26 10:20 ` Peter Stephenson
  0 siblings, 0 replies; 40+ messages in thread
From: Peter Stephenson @ 2000-06-26 10:20 UTC (permalink / raw)
  To: Zsh users list

not quite sure who's forwarding what to whom here...
> Ps: this new completion system could be a big win if it had 
> easy to understand dialog-like boxes which one could use to
> choose styles and tags and so on. :)
>  At least for me it is much too difficult in the present state.
>  I know that i can do almost anything with it but it still takes
>  a lot of my time to understand it. :(

Use compinstall.  I would like feedback, but the format is restricted by
the fact that it will be written in zsh, so there are menus but no dialogue
boxes.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* (forw) --help able programs and completion
@ 2000-06-26 10:14 Roland Jesse
  2000-06-26 10:20 ` Peter Stephenson
  0 siblings, 1 reply; 40+ messages in thread
From: Roland Jesse @ 2000-06-26 10:14 UTC (permalink / raw)
  To: Zsh Users

----- Forwarded message from Matthias Kopfermann <kopfermann@trio-hittfeld.de> -----

Date: Mon, 26 Jun 2000 12:13:15 +0200
From: Matthias Kopfermann <kopfermann@trio-hittfeld.de>
To: Bart Schaefer <schaefer@candle.brasslantern.com>
Cc: Roland Jesse <jesse@prinz.cs.uni-magdeburg.de>
Subject: --help able programs and completion
X-Mailer: Mutt 1.0i

Hi all,

I would like to have _all_ programs that have `--help'
to be completed with the right "--words".

Any idea how i could achieve that?

Of course i don't want to let the already existing completion
system for many programs to be overridden.
Only if there is _no_ completion there should ZSH  take the --help
approach.

Ps: this new completion system could be a big win if it had 
easy to understand dialog-like boxes which one could use to
choose styles and tags and so on. :)
 At least for me it is much too difficult in the present state.
 I know that i can do almost anything with it but it still takes
 a lot of my time to understand it. :(

 --
 Unix is not _beginners_ friedly, thats the problem. No reason
 for a joke here.

----- End forwarded message -----


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

end of thread, other threads:[~2000-08-02 19:12 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <no.id>
2000-06-08 14:31 ` wish for a colored completion system Matthias Kopfermann
2000-06-08 14:49   ` Sven Wischnowsky
2000-06-08 14:50   ` Thomas Köhler
2000-06-08 15:11     ` Matthias Kopfermann
2000-06-08 15:32       ` have to get used to the new zstyle thingy! Matthias Kopfermann
     [not found]         ` <0FVU005MNF7Q6N@la-la.cambridgesiliconradio.com>
2000-06-08 17:37           ` wish for a colored completion system Bart Schaefer
2000-06-08 18:44             ` Fletch
     [not found]               ` <000608122524.ZM16857@candle.brasslantern.com>
     [not found]                 ` <m2bt1c0xoe.fsf@godzilla.phydeaux.org>
2000-06-08 20:07                   ` Bart Schaefer
2000-06-08 20:18                     ` Fletch
2000-06-08 20:36                       ` Peter Stephenson
2000-06-09 13:36 ` Matthias Kopfermann
2000-06-14 13:43 ` Fun zsh trick for today Matthias Kopfermann
2000-06-14 13:57   ` Clint Adams
2000-06-14 14:09     ` Ollivier Robert
2000-06-14 15:02       ` Fletch
2000-06-14 14:15     ` Peter Stephenson
2000-06-14 14:21       ` Peter Stephenson
2000-06-14 14:27       ` Clint Adams
2000-06-14 14:37       ` Bart Schaefer
2000-06-14 15:33 ` Matthias Kopfermann
2000-06-14 15:52   ` Peter Stephenson
2000-06-14 16:31 ` Matthias Kopfermann
2000-06-26 10:23 ` (forw) --help able programs and completion Matthias Kopfermann
2000-06-26 10:30 ` Matthias Kopfermann
2000-06-29 11:41 ` is the reference card for zsh still 3.0 ? Matthias Kopfermann
2000-07-05 10:47 ` Matthias Kopfermann: Re: coloring of --help completion possible? Matthias Kopfermann
2000-07-17 13:39 ` wanted: viins-mode and digit argument with a,i,A and such Matthias Kopfermann
2000-07-17 14:06   ` Peter Stephenson
2000-07-21 10:42 ` completion for GNU color ls, anyone? Matthias Kopfermann
2000-07-21 15:17   ` Adam Spiers
2000-07-21 10:58 ` Matthias Kopfermann
2000-07-21 15:54   ` Bart Schaefer
2000-07-21 16:00 ` Matthias Kopfermann
2000-07-26 16:24 ` how can one let completion work *inside* zsh scripts? Matthias Kopfermann
2000-07-27 12:42 ` Matthias Kopfermann
2000-08-01 15:34 ` Matthias Kopfermann
2000-06-26 10:45 (forw) --help able programs and completion Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-06-26 10:14 Roland Jesse
2000-06-26 10:20 ` Peter Stephenson
2000-06-08 10:41 wish for a colored completion system Sven Wischnowsky

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