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

Re: Preventing sorting in completers



On Jul 12,  7:49pm, Philippe Troin wrote:
} 
} zstyle ":completion:*:processes" command \
}   'ps -u $UID -o ''pid tty s args'' --forest'

Hmm.  When I try to use that set of "ps" arguments, I get no completions
at all.  Some investigation reveals that "ps" is giving

ERROR: TTY could not be found.

However, assuming that it's working for you ...

} The problem is that the completion frameworks show the process list
} sorted by PID. How can I prevent that and get the process list in the
} order it was returned by ps (so that --forest makes sense).

You need to edit the _pids function and change the line

 _wanted processes expl 'process ID' compadd "$@" "$desc[@]" "$all[@]" -a pids && ret=0

To

 _wanted -V processes expl 'process ID' compadd "$@" "$desc[@]" "$all[@]" -a pids && ret=0

Bonus points for making use of the "sort" style and submitting a patch ...



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