about summary refs log tree commit diff
path: root/Completion/Zsh/Type/_command_names
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Zsh/Type/_command_names')
-rw-r--r--Completion/Zsh/Type/_command_names11
1 files changed, 10 insertions, 1 deletions
diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index 006006348..71c3adfd2 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -8,9 +8,18 @@ local args defs
 
 defs=(
   'commands:external command:compadd -k commands'
-  'executables:executable file or directory:_path_files -/g \*\(-\*\)'
 )
 
+if [[ -n "$path[(r).]" ]]; then
+  defs=( "$defs[@]"
+         'executables:executable file or directory:_path_files -/g \*\(-\*\)'
+  )
+else
+  defs=( "$defs[@]"
+         'executables:executable file or directory:_files -P/ -W/ -/g \*\(-\*\)'
+  )
+fi
+
 if [[ "$1" = -e ]]; then
   shift
 else