Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Questions about _values



Hello,

I'm trying to write some completions with mixed success. Currently one
of my completions looks like this:

{vsun}/# pcred  <TAB pressed here
0                          --     root sched                                   
1                          --     root /sbin/init                              
122                        --     root /usr/sbin/nscd                          
125                        --     root /usr/lib/sysevent/syseventd             
134                        --   daemon /usr/lib/crypto/kcfd                    
140                        --     root /usr/lib/power/powerd                   
1402  2777  438            --     root /usr/lib/ssh/sshd                       
143                        --     root /usr/lib/picl/picld                     
2                          --     root pageout                                 
237                        --     root /usr/bin/VBoxService                    
238                        --     root /usr/sbin/cron                          
2780  1405                 --     dave /usr/lib/ssh/sshd                       
2782  1407                 --     dave -zsh
...

Argument is a PID, completed with _values. 

1. I tried to get the same effect with _describe, but I don't know how
   to do that (value grouping if description is the same and the "--"
   separator). I looked at _values source, but I don't understand how
   it does what it does. I suppose compvalues does the trick somehow. How
   do I produce the above output with _describe?

2. Is there a way to tell _values to limit the maximum number of items
   in a group? In the above example the description (process name) is
   more important than the items, so I'd like to avoid description
   trimming which happens by default.

3. Is there a way to tell _values (or _describe) to sort offered
   completions by description and not by item? In that case I'd get sort
   by username here, which is much better than sort by PID.

   Also, is there a way to tell them not to sort? The completion list
   could already be sorted in a meaningful way.

4. If I keep pressing TAB, zsh will offer completions. Is there a way to
   make it highlight (print the characters in bold or some color, for
   example) the offered item and its description in the list?
   Here the offered completions (PIDs) aren't descriptive, so the user must
   associate them with the descriptions (command names) to actually select
   what he wanted. It's hard to do vithout visual cue.

-- 
 .-.   .-.    Yes, I am an agent of Satan, but my duties are largely
(_  \ /  _)   ceremonial.
     |
     |        dave@xxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author