summaryrefslogtreecommitdiffstats
path: root/zsh/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
commitaf120ab348f2e1a5a39dec035ed9dcf84189a64e (patch)
tree2a3aadd7ce1b7b771dfe3fe7c983569726c8d7ed /zsh/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill
downloaddotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.gz
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.bz2
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.zip
dotfiles
Diffstat (limited to 'zsh/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill')
-rw-r--r--zsh/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill41
1 files changed, 41 insertions, 0 deletions
diff --git a/zsh/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill b/zsh/oh-my-zsh/plugins/zsh-navigation-tools/_n-kill
new file mode 100644
index 0000000..9da68b9
--- /dev/null
+++ b/zsh/oh-my-zsh/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 -M 'm:{a-z}={A-Z}' "$@" -a - words && ret=0
+
+return "$ret"