summaryrefslogtreecommitdiff
path: root/plugins/zsh-navigation-tools/_n-kill
diff options
context:
space:
mode:
authorSebastian Gniazdowski <sgniazdowski@gmail.com>2016-04-30 15:16:00 +0200
committerSebastian Gniazdowski <sgniazdowski@gmail.com>2016-05-16 16:29:17 +0200
commite2d157d5895717e983e5cc4e5df792a6a5dbe0ac (patch)
treec3b11213c62fc7d7e805efa3374a45d601de0031 /plugins/zsh-navigation-tools/_n-kill
parent19769fded2d95b1e81a72ee7ebd3d9bd53f0d422 (diff)
downloadzsh-e2d157d5895717e983e5cc4e5df792a6a5dbe0ac.tar.gz
zsh-e2d157d5895717e983e5cc4e5df792a6a5dbe0ac.tar.bz2
zsh-e2d157d5895717e983e5cc4e5df792a6a5dbe0ac.zip
znt: update to v2.1.15
Diffstat (limited to 'plugins/zsh-navigation-tools/_n-kill')
-rw-r--r--plugins/zsh-navigation-tools/_n-kill41
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/zsh-navigation-tools/_n-kill b/plugins/zsh-navigation-tools/_n-kill
new file mode 100644
index 000000000..8a4ec9da7
--- /dev/null
+++ b/plugins/zsh-navigation-tools/_n-kill
@@ -0,0 +1,41 @@
+#compdef n-kill
+
+local context ret=1
+
+typeset -a list linewords
+typeset -aU words wordbits
+local line word
+integer cygwin=0
+
+local IFS="
+"
+
+case "$(uname)" in
+ CYGWIN*) list=( `command ps -Wa` ); cygwin=1 ;;
+ *) list=( `command ps -o pid,uid,command -A` ) ;;
+esac
+
+shift list
+
+IFS=" "
+for line in "${list[@]}"; do
+ linewords=( $=line )
+ if [ "$cygwin" = "1" ]; then
+ linewords=( "${(@)linewords[8,-1]}" )
+ else
+ linewords=( "${(@)linewords[3,-1]}" )
+ fi
+ for word in "${linewords[@]}"; do
+ if [ "$cygwin" = "1" ]; then
+ wordbits=( "${(@s:\:)word}" )
+ else
+ wordbits=( "${(@s:/:)word}" )
+ fi
+ words+=( "${wordbits[@]}" )
+ done
+done
+
+_wanted bits expl "Processes' name bits" \
+ compadd "$@" -a - words && ret=0
+
+return "$ret"