* Re: wish for a colored completion system
@ 2000-06-09 7:24 Sven Wischnowsky
0 siblings, 0 replies; 14+ messages in thread
From: Sven Wischnowsky @ 2000-06-09 7:24 UTC (permalink / raw)
To: zsh-users
Bart Schaefer wrote:
> 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?
Hm, yes, the description in the docs make it sound as if it should
work. The problem is that without separate groups there is no way for
the completion code to find out that with
zstyle ':completion:*:ssh:*:hosts' list-colors '=a*=31'
zstyle ':completion:*:ssh:*:users' list-colors '=b*=32'
hosts starting with `b' should be coloured with `32'. We would need a
per-match colouring for that and that's too expensive.
And to come back to the question, the completion code only looks up
the style with the tag in the context and it can't find out that the
pattern used in the definition doesn't contain the tag. If we wanted
to solve that, we would have to make _setup get the name of the group
(which may be -default-) as an argument (when called from
_description) and use that name in ZLS_COLORS. But then we would be
back to what I said above.
So, we could (quite easily) change it, but that set-for-one-tag-and-
used-for-others-too made me do it in the way we have it now, I would
be willing to write the change if people say that they prefer it,
though (I have group-name == '', so I don't care much about this).
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <no.id>]
* 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
1 sibling, 2 replies; 14+ 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] 14+ messages in thread
* Re: wish for a colored completion system
@ 2000-06-08 14:49 ` Sven Wischnowsky
0 siblings, 0 replies; 14+ 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] 14+ messages in thread
* Re: wish for a colored completion system
2000-06-08 14:31 ` 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; 14+ 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] 14+ messages in thread
* Re: wish for a colored completion system
[not found] <no.id>
2000-06-08 14:31 ` Matthias Kopfermann
@ 2000-06-09 13:36 ` Matthias Kopfermann
1 sibling, 0 replies; 14+ 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] 14+ messages in thread
* Re: wish for a colored completion system
@ 2000-06-08 10:41 Sven Wischnowsky
0 siblings, 0 replies; 14+ 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] 14+ messages in thread
* wish for a colored completion system
@ 2000-06-07 15:20 Matthias Kopfermann
2000-06-07 16:09 ` Bart Schaefer
0 siblings, 1 reply; 14+ messages in thread
From: Matthias Kopfermann @ 2000-06-07 15:20 UTC (permalink / raw)
To: zsh-users
Hi all,
generally i am quite exited about the zsh.
there is one feature that i really would like to have:
colored completion.
(I love colored completion when i hit ls<tab>.
i want it with other completions , too , not only
when i try to complete filenames .
thats why i would
love to have colored completion programmable.)
any thoughts about that?
otherwise i hope the near future can provide that :)
(whoever the future might be ... :) )
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: wish for a colored completion system
2000-06-07 15:20 Matthias Kopfermann
@ 2000-06-07 16:09 ` Bart Schaefer
0 siblings, 0 replies; 14+ messages in thread
From: Bart Schaefer @ 2000-06-07 16:09 UTC (permalink / raw)
To: Matthias Kopfermann, zsh-users
On Jun 7, 5:20pm, Matthias Kopfermann wrote:
} Subject: wish for a colored completion system
}
} (I love colored completion when i hit ls<tab>.
} i want it with other completions , too , not only
} when i try to complete filenames .
Check out the `list-colors' style, which can be used to override the
ZLS_COLORS parameter on a per-completion basis.
The doc for ZLS_COLORS (actually, for the complist module, there is no
independent entry for the parameter) in 3.1.9 says:
Apart from these strings, the NAME may also be an asterisk (`*')
followed by any string. The VALUE given for such a string will be
used for all files whose name ends with the string. The NAME may
also be a equal sign (`=') followed by a pattern. The VALUE given
for this pattern will be used for all matches (not just filenames)
whose display string are matched by the pattern. Definitions for
both of these take precedence over the values defined for file types
and the form with the leading asterisk takes precedence over the
form with the leading equal sign.
So for example one can do
zstyle ':completion:*:zsh-options' \
list-colors '=csh*=31:=*hist*=32:=list*=34:=*glob*=35'
to have csh options in red, history options in green, completion listing
options in blue, and globbing options in magenta. The patterns are tried
left to right, so "cshnullglob" is in red, not magenta. Unfortunately,
you can't specify that csh gets a red foreground and globs get a yellow
background and have them overlap; oh, well.
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.
--
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] 14+ messages in thread
end of thread, other threads:[~2000-06-09 14:15 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-09 7:24 wish for a colored completion system Sven Wischnowsky
[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-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
-- strict thread matches above, loose matches on Subject: below --
2000-06-08 10:41 Sven Wischnowsky
2000-06-07 15:20 Matthias Kopfermann
2000-06-07 16:09 ` Bart Schaefer
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).