Is there any way to enable arrow keys selection for the kill command in zsh?
E.g.
$ kill <TAB>
gives me a list of all currently running processes, and I can then use arrow keys to select a specific one.
However, when I do:
$ kill foo<TAB>
I get a list of all processes with foo
in the name, but I cannot select a specific one from the list via arrow keys.
I've tried looking at the compdef file for kill
but am not familiar enough with how the zsh completion system works to understand what needs to be changed in order for it to work.
In case it is of any help, here is my current compdef for kill, at least I assume it is. The file location on my system is: /usr/share/zsh/functions/Completion/Zsh/_kill
#compdef kill
local curcontext="$curcontext" line state ret=1
typeset -A opt_args
_arguments -C \
'(-s -l 1)-n[specify signal number]:signal number' \
'(-n -l 1)-s[specify signal name]:signal:_signals -s' \
'(-n -s)-l[list signal names or numbers of specified signals]:*:signal:_signals' \
'(-n -s -l)1::signal:_signals -p -s' \
'*:processes:->processes' && ret=0
if [[ -n "$state" ]]; then
local pgrp='process-groups:: _wanted '
[[ -n "$opt_args[(i)-[ns]]${${(@)line:#--}}" && -prefix - ]] && pgrp+='-x '
pgrp+="process-groups expl 'process-group' compadd - 0"
_alternative \
'processes:: _pids' \
'jobs:: _jobs -t' $pgrp && ret=0
fi
return ret