zsh-workers
 help / color / mirror / code / Atom feed
* zsh pid completion
@ 2016-05-17 10:50 Marko Myllynen
  2016-05-17 16:48 ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Marko Myllynen @ 2016-05-17 10:50 UTC (permalink / raw)
  To: zsh workers

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.)

Thanks,

-- 
Marko Myllynen


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh pid completion
  2016-05-17 10:50 zsh pid completion Marko Myllynen
@ 2016-05-17 16:48 ` Mikael Magnusson
  2016-05-19 21:14   ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2016-05-17 16:48 UTC (permalink / raw)
  To: Marko Myllynen; +Cc: zsh workers

On Tue, May 17, 2016 at 12:50 PM, Marko Myllynen <myllynen@redhat.com> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh pid completion
  2016-05-17 16:48 ` Mikael Magnusson
@ 2016-05-19 21:14   ` Daniel Shahaf
  2016-05-20  7:41     ` Marko Myllynen
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-05-19 21:14 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Marko Myllynen, zsh workers

Mikael Magnusson wrote on Tue, May 17, 2016 at 18:48:24 +0200:
> On Tue, May 17, 2016 at 12:50 PM, Marko Myllynen <myllynen@redhat.com> 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'

There's also a variant that allows cycling through user processes, all
user processes, and all processes:

http://www.zsh.org/cgi-bin/mla/redirect?USERNUMBER=20372

('_next_tags' is a widget that needs to be bindkey'd; I bind it to ^Xn)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: zsh pid completion
  2016-05-19 21:14   ` Daniel Shahaf
@ 2016-05-20  7:41     ` Marko Myllynen
  0 siblings, 0 replies; 4+ messages in thread
From: Marko Myllynen @ 2016-05-20  7:41 UTC (permalink / raw)
  To: Daniel Shahaf, Mikael Magnusson; +Cc: zsh workers

Hi,

On 2016-05-20 00:14, Daniel Shahaf wrote:
> Mikael Magnusson wrote on Tue, May 17, 2016 at 18:48:24 +0200:
>> On Tue, May 17, 2016 at 12:50 PM, Marko Myllynen <myllynen@redhat.com> wrote:
>>>
>>> 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'
> 
> There's also a variant that allows cycling through user processes, all
> user processes, and all processes:
> 
> http://www.zsh.org/cgi-bin/mla/redirect?USERNUMBER=20372
> 
> ('_next_tags' is a widget that needs to be bindkey'd; I bind it to ^Xn)

Nice, this is handy indeed. The next thing I was about to as was
completions for pidof(8) but with the above something like "ps s<tab>"
works better than plain pidof(8).

Thanks,

-- 
Marko Myllynen


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-20  7:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-17 10:50 zsh pid completion Marko Myllynen
2016-05-17 16:48 ` Mikael Magnusson
2016-05-19 21:14   ` Daniel Shahaf
2016-05-20  7:41     ` Marko Myllynen

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).