zsh-workers
 help / color / mirror / code / Atom feed
From: "Dražen Kačar" <dave@fly.srk.fer.hr>
To: zsh-workers@sunsite.dk
Subject: Questions about _values
Date: Mon, 26 Jan 2009 00:36:07 +0100	[thread overview]
Message-ID: <20090125233607.GA30627@fly.srk.fer.hr> (raw)

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@fly.srk.fer.hr


             reply	other threads:[~2009-01-25 23:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-25 23:36 Dražen Kačar [this message]
2009-01-26  2:55 ` Greg Klanderman
2009-01-26 21:10   ` Dražen Kačar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090125233607.GA30627@fly.srk.fer.hr \
    --to=dave@fly.srk.fer.hr \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).