summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2019-04-04 18:45:19 -0500
committerMatthew Martin <phy1729@gmail.com>2019-04-04 18:45:19 -0500
commit5facfd32805831230f9b42b7ec9765e858b553a8 (patch)
tree338774bab29346eaa1f29dff5813f71611613157 /Completion
parentbb790c8f8118d4428d8effc65b1c5dc03d1637f6 (diff)
downloadzsh-5facfd32805831230f9b42b7ec9765e858b553a8.tar.gz
zsh-5facfd32805831230f9b42b7ec9765e858b553a8.tar.xz
zsh-5facfd32805831230f9b42b7ec9765e858b553a8.zip
44200 (tweaked): Completion: Append to precommands in _normal
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Core/_normal5
-rw-r--r--Completion/Linux/Command/_setsid4
-rw-r--r--Completion/Zsh/Command/_builtin4
-rw-r--r--Completion/Zsh/Command/_command5
-rw-r--r--Completion/Zsh/Command/_exec4
-rw-r--r--Completion/Zsh/Command/_precommand5
6 files changed, 8 insertions, 19 deletions
diff --git a/Completion/Base/Core/_normal b/Completion/Base/Core/_normal
index fe336e303..7732837ac 100644
--- a/Completion/Base/Core/_normal
+++ b/Completion/Base/Core/_normal
@@ -1,10 +1,11 @@
 #compdef -command-line-
 
-local _comp_command1 _comp_command2 _comp_command
+local _comp_command1 _comp_command2 _comp_command precommand
 local -A opts
 
-zparseopts -A opts -D - s
+zparseopts -A opts -D - p+:-=precommand s
 (( $+opts[-s] )) || _compskip=
+(( $#precommand )) && precommands+=(${precommand#-p})
 
 # Check for a history reference to complete modifiers.
 # $PREFIX has a quoted form of the !, so we can't test that
diff --git a/Completion/Linux/Command/_setsid b/Completion/Linux/Command/_setsid
index a8107e582..f3aef500a 100644
--- a/Completion/Linux/Command/_setsid
+++ b/Completion/Linux/Command/_setsid
@@ -1,7 +1,5 @@
 #compdef setsid
 
-[[ $service == setsid ]] && precommands+=( setsid )
-
 _arguments -s -S -A '-*' : \
   '(: * -)'{-h,--help}'[display help information]' \
   '(: * -)'{-V,--version}'[display version information]' \
@@ -9,4 +7,4 @@ _arguments -s -S -A '-*' : \
   '(-f --fork)'{-f,--fork}'[always fork]' \
   '(-w --wait)'{-w,--wait}'[wait for program to exit, and use same return code]' \
   '1: :_path_commands' \
-  '*:: : _normal'
+  '*:: : _normal -p $service'
diff --git a/Completion/Zsh/Command/_builtin b/Completion/Zsh/Command/_builtin
index a77af9879..ffb7b8c8d 100644
--- a/Completion/Zsh/Command/_builtin
+++ b/Completion/Zsh/Command/_builtin
@@ -1,11 +1,9 @@
 #compdef builtin
 
-precommands+=(builtin)
-
 if (( $CURRENT > 2 )); then
   shift words
   (( CURRENT -- ))
-  _normal
+  _normal -p $service
 else
   local expl
 
diff --git a/Completion/Zsh/Command/_command b/Completion/Zsh/Command/_command
index 4e2858676..7a59a2386 100644
--- a/Completion/Zsh/Command/_command
+++ b/Completion/Zsh/Command/_command
@@ -1,11 +1,8 @@
 #compdef command
 
-# indicate if this is a precommand modifier
-[[ $service = command ]] && precommands+=(command)
-
 _arguments \
   '-v[indicate result of command search]:*:command:_path_commands' \
   '-V[show result of command search in verbose form]:*:command:_path_commands' \
   '(-)-p[use default PATH to find command]' \
   ':command:_path_commands' \
-  '*::arguments: _normal'
+  '*:: : _normal -p $service'
diff --git a/Completion/Zsh/Command/_exec b/Completion/Zsh/Command/_exec
index 8de341a02..2498b57c0 100644
--- a/Completion/Zsh/Command/_exec
+++ b/Completion/Zsh/Command/_exec
@@ -1,9 +1,7 @@
 #compdef exec
 
-[[ $service == exec ]] && precommands+=( exec )
-
 _arguments -s -S -A '-*' : \
   '-a+[set argv\[0\] to specified string]:argv[0] string' \
   '-c[clear environment]' \
   '-l[simulate login shell (prepend - to argv\[0\])]' \
-  '*:: : _normal'
+  '*:: : _normal -p $service'
diff --git a/Completion/Zsh/Command/_precommand b/Completion/Zsh/Command/_precommand
index c9eef78af..fd88074c0 100644
--- a/Completion/Zsh/Command/_precommand
+++ b/Completion/Zsh/Command/_precommand
@@ -1,9 +1,6 @@
 #compdef - nohup eval time rusage noglob nocorrect catchsegv aoss hilite eatmydata
 
-# precommands is made local in _main_complete
-precommands+=($words[1])
-
 shift words
 (( CURRENT-- ))
 
-_normal
+_normal -p $service