Subject: Re: zsh pid completion
From: Mikael Magnusson <[email-masked]>
To: Marko Myllynen <[email-masked]>
Cc: zsh workers <[email-masked]>
Date: Tue, 17 May 2016 18:48:24 +0200
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Tue, May 17, 2016 at 12:50 PM, Marko Myllynen <[email-masked]> wrote:
> Hi,
>
> I see that _pids completion offers only a very limited subset of the
> running pids (even by the same user). For example, if I launch a command
> on a terminal its PID is not included in completion alternatives on
> another terminal. Also, when root, in some cases it might be beneficial
> to offer also non-root PIDs (perhaps this could be configurable).
>
> Is there some reason for this limited approach? (I'm not sending any
> patches yet, I'm afraid with ps(1) portability might be a bit tricky.)

No need for a patch, you can just set a style to run whatever ps
command you like to generate the matches, i use:
zstyle ':completion:*:processes' command 'ps ax -o
user,pid,nice,%cpu,%mem,vsz,rss,tname,stat,start,time,command
--sort=-%cpu'

These are also possible
zstyle ':completion:*:processes' command 'ps aux'
zstyle ':completion:*:processes' command 'ps --forest -A -o pid,user,cmd'

-- 
Mikael Magnusson