From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24570 invoked by alias); 19 May 2016 21:21:11 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 38517 Received: (qmail 21881 invoked from network); 19 May 2016 21:21:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 Date: Thu, 19 May 2016 21:14:05 +0000 From: Daniel Shahaf To: Mikael Magnusson Cc: Marko Myllynen , zsh workers Subject: Re: zsh pid completion Message-ID: <20160519211405.GA8007@tarsus.local2> References: <573AF76D.2010106@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Mikael Magnusson wrote on Tue, May 17, 2016 at 18:48:24 +0200: > On Tue, May 17, 2016 at 12:50 PM, Marko Myllynen 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)