Process Completion

kill

When completing process IDs I normally want to fall into menu selection, too:

zstyle ':completion:*:*:kill:*' menu yes select

But I also want to make sure that I always get the list, even if I complete on a command name prefix instead of a PID and there is only one possible completion, which is inserted right away. This means that the completion system shows me the excerpt from the `ps(1)' output for verification that the inserted PID is indeed the one of the command I want to kill:

zstyle ':completion:*:kill:*' force-list always

Generic

You may want to generalize the first part:

zstyle ':completion:*:*:*:*:processes' menu yes select
zstyle ':completion:*:*:*:*:processes' force-list always

pkill

You want a completion function for pkill? write it :p or use one of the following, regarding the behavior you want:

compdef pkill=kill
compdef pkill=killall

Process name completion

 zstyle ':completion:*:processes-names' command  'ps c -u ${USER} -o command | uniq'
 
examples/compsys/processes.txt · Last modified: 2010/01/05 09:20 (external edit)