* Coloring completions
@ 2004-07-14 11:21 DervishD
2004-07-15 3:27 ` Bart Schaefer
0 siblings, 1 reply; 9+ messages in thread
From: DervishD @ 2004-07-14 11:21 UTC (permalink / raw)
To: Zsh Users
Hi all :)
I'm playing with compsys, and I don't understand what happens
with coloring. I currently don't use the shell functions for
completion, I use compsys but 'naked' (resuming: I don't have any
compinit call in my RC's), and when I hit 'TAB' (which currently is
bound to 'expand-or-complete'), the completions appear colored
, and that's ok because I have zsh/complist loaded. The problem
appears when I do the following:
bindkey "^O" completer
zle -C completer expand-or-complete completer
function completer () {
if [[ $words[1] == cd ]]
then
compadd -f *(/)
else
compadd -f *
fi
}
That's a stupid test to play with compsys. If I do the above,
when I hit '^O', depending on the first word only dirs or all files
are listed, but they are listed without coloring. I thought coloring
was automatic as long as zsh/complist was loaded. If I do the above
(remember: I don't use the compsys shell functions), do I need to
'color' de completion matches myself?
If it is not long, boring or off-topic: could anyone explain me
how the shell functions given with compsys do the coloring or what
should I read first to understand how _main_complete et al. do the
coloring? Given that _main_complete is far complex that my crappy
function above ;) the principles should be the same and the
completion matches are generated by compadd calls, so the coloring is
done by some function or by compsys itself, am I wrong?
Thanks a lot in advance :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coloring completions
2004-07-14 11:21 Coloring completions DervishD
@ 2004-07-15 3:27 ` Bart Schaefer
2004-07-15 10:50 ` DervishD
0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2004-07-15 3:27 UTC (permalink / raw)
To: Zsh Users
On Wed, 14 Jul 2004, DervishD wrote:
> I'm playing with compsys, and I don't understand what happens
> with coloring.
[...]
> when I hit 'TAB' (which currently is bound to 'expand-or-complete'), the
> completions appear colored, and that's ok because I have zsh/complist
[...]
> when I hit '^O', depending on the first word only dirs or all files
> are listed, but they are listed without coloring.
I'm not able to reproduce your problem. I get coloring in both cases.
Are you _sure_ zsh/complist is loaded? Are you sure you have ZLS_COLORS
set properly?
> I thought coloring was automatic as long as zsh/complist was loaded.
It is.
> If it is not long, boring or off-topic: could anyone explain me
> how the shell functions given with compsys do the coloring
The shell functions in compsys don't do anything magical. They just read
a value from a style and assign that to ZLS_COLORS, then restore the old
ZLS_COLORS value after finishing.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coloring completions
2004-07-15 3:27 ` Bart Schaefer
@ 2004-07-15 10:50 ` DervishD
2004-07-15 15:21 ` Bart Schaefer
0 siblings, 1 reply; 9+ messages in thread
From: DervishD @ 2004-07-15 10:50 UTC (permalink / raw)
To: zsh-users
Hi Bart :)
Thanks for answering :)
* Bart Schaefer <schaefer@brasslantern.com> dixit:
> > I'm playing with compsys, and I don't understand what happens
> > with coloring.
> [...]
> > when I hit 'TAB' (which currently is bound to 'expand-or-complete'), the
> > completions appear colored, and that's ok because I have zsh/complist
> [...]
> > when I hit '^O', depending on the first word only dirs or all files
> > are listed, but they are listed without coloring.
> I'm not able to reproduce your problem. I get coloring in both cases.
> Are you _sure_ zsh/complist is loaded? Are you sure you have ZLS_COLORS
> set properly?
ZLS_COLORS and ZLS_COLOURS are bot set and working (AFAIK...) and
zsh/complist is loaded:
$ zmodload
zsh/compctl
zsh/complete
zsh/complist
zsh/main
zsh/zle
Hey, that's weird :((( I'm testing again completion and *all*
colorable files are colored *except* directories :( I mean, if I use
default completion (not my widget and function), directories are
colored, otherwise they aren't, that's the only difference :?
> > If it is not long, boring or off-topic: could anyone explain me
> > how the shell functions given with compsys do the coloring
> The shell functions in compsys don't do anything magical. They just read
> a value from a style and assign that to ZLS_COLORS, then restore the old
> ZLS_COLORS value after finishing.
OK, that's what I assumed from what I read in _setup,
_main_complete and others. BTW, my ZLS_COLORS parameter is:
no=00:fi=00:di=01;37:ln=01;36:pi=05;33:so=01;35:bd=01;33\
:cd=01;33:or=01;05;31:ex=01;32:*.tar=01;34:*.tgz=01;34\
:*.z=01;34:*.Z=01;34:*.gz=01;34:*.bz2=01;34:
ZLS_COLOURS is exactly the same. If I change the color for the
'di' entry, the default completion shows directories with the
appropriate color, but my widget doesn't, it doesn't color them. The
same if I remove the 'di' entry: the default completion colors them
red, mine doesn't color at all. Known bug in my version?
Thanks again Bart, you're so kind :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coloring completions
2004-07-15 10:50 ` DervishD
@ 2004-07-15 15:21 ` Bart Schaefer
2004-07-15 16:36 ` DervishD
0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2004-07-15 15:21 UTC (permalink / raw)
To: zsh-users
On Thu, 15 Jul 2004, DervishD wrote:
> Hey, that's weird :((( I'm testing again completion and *all*
> colorable files are colored *except* directories
unsetopt markdirs
When markdirs is set, the expansion of the glob appends a trailing slash
to the file name, and thus the coloring code no longer recognizes it as
being a string match for the actual directory name.
(When you're using default completion the file expansion is all done in
the internals and markdirs is ignored.)
You might want to take a look at the value assigned to the _comp_options
array in compinit, and the subsequent _comp_setup assignment. One of
the first things _main_complete does is to eval that setup string.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coloring completions
2004-07-15 15:21 ` Bart Schaefer
@ 2004-07-15 16:36 ` DervishD
2004-07-16 2:20 ` Bart Schaefer
0 siblings, 1 reply; 9+ messages in thread
From: DervishD @ 2004-07-15 16:36 UTC (permalink / raw)
To: zsh-users
Hi Bart :)
* Bart Schaefer <schaefer@brasslantern.com> dixit:
> > Hey, that's weird :((( I'm testing again completion and *all*
> > colorable files are colored *except* directories
> unsetopt markdirs
Oh, my... Thanks, Bart, you're great :)
> When markdirs is set, the expansion of the glob appends a trailing slash
> to the file name, and thus the coloring code no longer recognizes it as
> being a string match for the actual directory name.
Why it doesn't happen with executable names (which has an
asterisk added) or other kind of files? I mean, why 'listtypes'
doesn't have the same effect?
> (When you're using default completion the file expansion is all done in
> the internals and markdirs is ignored.)
But the same is not applicable to 'listtypes'. Doesn't seem that
weird?
> You might want to take a look at the value assigned to the _comp_options
> array in compinit, and the subsequent _comp_setup assignment. One of
> the first things _main_complete does is to eval that setup string.
Yes, I've took a look at it: very clever and useful :)) Thanks a
lot, Bart, as always :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coloring completions
2004-07-15 16:36 ` DervishD
@ 2004-07-16 2:20 ` Bart Schaefer
2004-07-16 8:20 ` DervishD
0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2004-07-16 2:20 UTC (permalink / raw)
To: zsh-users
On Thu, 15 Jul 2004, DervishD wrote:
> > When markdirs is set, the expansion of the glob appends a trailing
> > slash to the file name, and thus the coloring code no longer
> > recognizes it
>
> Why it doesn't happen with executable names (which has an asterisk
> added) or other kind of files? I mean, why 'listtypes' doesn't have the
> same effect?
I think it'll become obvious if you re-read the documentation for each of
those setopts:
-----
MARK_DIRS (-8, ksh: -X)
Append a trailing `/' to all directory names resulting from
filename generation (globbing).
LIST_TYPES (-X) <D>
When listing files that are possible completions, show the type of
each file with a trailing identifying mark.
-----
Specifically, when you write "compadd -f *" the effect of MARK_DIRS is
seen on the input (arguments) to compadd, but the effect of LIST_TYPES is
seen on the output (the completion listing). So the color matching can
already be done _before_ LIST_TYPES is applied, but it necessarily must be
done _after_ MARK_DIRS.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coloring completions
2004-07-16 2:20 ` Bart Schaefer
@ 2004-07-16 8:20 ` DervishD
0 siblings, 0 replies; 9+ messages in thread
From: DervishD @ 2004-07-16 8:20 UTC (permalink / raw)
To: zsh-users
Hi Bart :)
* Bart Schaefer <schaefer@brasslantern.com> dixit:
> > Why it doesn't happen with executable names (which has an asterisk
> > added) or other kind of files? I mean, why 'listtypes' doesn't have the
> > same effect?
> I think it'll become obvious if you re-read the documentation for each of
> those setopts:
>
> -----
> MARK_DIRS (-8, ksh: -X)
> Append a trailing `/' to all directory names resulting from
> filename generation (globbing).
>
> LIST_TYPES (-X) <D>
> When listing files that are possible completions, show the type of
> each file with a trailing identifying mark.
> -----
OK, now I got it. I assumed that MARK_DIRS worked after
completion listings (I don't know why I related the two options). Now
all makes sense. Thanks a lot, Bart, for all the explanations. I'm
going to get rid of MARK_DIRS right now.
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Coloring completions
[not found] ` <200511211902.46023.arvidjaar@mail.ru>
@ 2005-11-21 16:12 ` Nikolai Weibull
0 siblings, 0 replies; 9+ messages in thread
From: Nikolai Weibull @ 2005-11-21 16:12 UTC (permalink / raw)
To: ZSH Users
Andrey Borzenkov wrote:
> On Monday 21 November 2005 16:18, Nikolai Weibull wrote:
> > Is there any way to get colors in completions for something like
> > files in a tar archive? Seeing as how it would be possible to tell
> > if an entry is a directory or not, it would be nice if it was
> > highlighted like directories on the filesystem are. The same goes
> > for files with the executable bit set.
> zstyle ':completion:*:default' list-colors ""
That's not what I asked about.
nikolai
--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Coloring completions
@ 2005-11-21 13:18 Nikolai Weibull
[not found] ` <200511211902.46023.arvidjaar@mail.ru>
0 siblings, 1 reply; 9+ messages in thread
From: Nikolai Weibull @ 2005-11-21 13:18 UTC (permalink / raw)
To: ZSH Users
Is there any way to get colors in completions for something like files
in a tar archive? Seeing as how it would be possible to tell if an
entry is a directory or not, it would be nice if it was highlighted like
directories on the filesystem are. The same goes for files with the
executable bit set.
Thanks.
nikolai
--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-11-21 16:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-14 11:21 Coloring completions DervishD
2004-07-15 3:27 ` Bart Schaefer
2004-07-15 10:50 ` DervishD
2004-07-15 15:21 ` Bart Schaefer
2004-07-15 16:36 ` DervishD
2004-07-16 2:20 ` Bart Schaefer
2004-07-16 8:20 ` DervishD
2005-11-21 13:18 Nikolai Weibull
[not found] ` <200511211902.46023.arvidjaar@mail.ru>
2005-11-21 16:12 ` Nikolai Weibull
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).