Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
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
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:reply-to:subject:references:to:cc:from
         :organization:message-id:date:user-agent:mime-version:in-reply-to
         :content-transfer-encoding;
        bh=BslZ6v7x0Cnm228MfhrCLZPz9IedIO+qixpZ9TvSd7U=;
        b=eI7qlsUu24fRmiVb9rpZ/dFxQDnKLppKh3VcX/b4NPYFf5IyoCUNOecqjK17Hc0Xtt
         uAbtR9CQrn3MHpVH0HoHNJl0b4/3DcK490RKlZgmQbyH+vYCgFOnHw2MAGaIbR8+fE9t
         RafX6hrDmRj3Ny4/rUzYaon6ULLHBOwWkI/XYT/DbmqNpMmCrB6FVsuwuu0aKwtTiMPC
         /RXMDrDV3Jkp0+B4rCxANzafnERgmw1OxgJIn0sYLZtpJ3qmUp+50AcUmczRjhKOrPmD
         6Nm0/ig0tqd9/KnXddNLGcXkuXViXYM/nLg39ZAZom+1VdR1kDH/Hqb2xZAq62nnmxU8
         wyVA==
X-Gm-Message-State: AOPr4FV3cdLD4m5lZwFn5D+SmDz4bl82lZHPQlWfhK5ZPL2zhSobIPlcDdUSNudYx94nSnJE
X-Received: by 10.28.45.9 with SMTP id t9mr2049090wmt.89.1463730074627;
        Fri, 20 May 2016 00:41:14 -0700 (PDT)
Reply-To: Marko Myllynen <myllynen@redhat.com>
Subject: Re: zsh pid completion
References: <573AF76D.2010106@redhat.com>
 <CAHYJk3SDb5H9wQ8fmbwegTUYMS5xbQnqEQoVn0oWVBZr_UYJLA@mail.gmail.com>
 <20160519211405.GA8007@tarsus.local2>
To: Daniel Shahaf <d.s@daniel.shahaf.name>,
 Mikael Magnusson <mikachu@gmail.com>
Cc: zsh workers <zsh-workers@zsh.org>
From: Marko Myllynen <myllynen@redhat.com>
Organization: Red Hat
Message-ID: <573EBF96.80806@redhat.com>
Date: Fri, 20 May 2016 10:41:10 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
 Thunderbird/38.8.0
MIME-Version: 1.0
In-Reply-To: <20160519211405.GA8007@tarsus.local2>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Seq: zsh-workers 38525

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

