about summary refs log tree commit diff
path: root/Completion/Unix/Type/_path_commands
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-01-08 16:04:38 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-01-08 16:04:38 +0000
commit8b87aca62e72927ce2b466a60a3c0a8de8193edb (patch)
tree00d31d826a3ba6465edc41087b9ef00421fc02b9 /Completion/Unix/Type/_path_commands
parentc214b86e9456b2e5eda47bc7710ced0c455df70e (diff)
downloadzsh-8b87aca62e72927ce2b466a60a3c0a8de8193edb.tar.gz
zsh-8b87aca62e72927ce2b466a60a3c0a8de8193edb.tar.xz
zsh-8b87aca62e72927ce2b466a60a3c0a8de8193edb.zip
users/16711: try to take account of PATH_DIRS option in command completion
Diffstat (limited to 'Completion/Unix/Type/_path_commands')
-rw-r--r--Completion/Unix/Type/_path_commands12
1 files changed, 12 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands
index 393c0c67e..22d2aaeba 100644
--- a/Completion/Unix/Type/_path_commands
+++ b/Completion/Unix/Type/_path_commands
@@ -82,6 +82,18 @@ if [[ -n $need_desc ]]; then
 else
   _wanted commands expl 'external command' compadd "$@" -k commands && ret=0
 fi
+if [[ -o path_dirs ]]; then
+  local -a path_dirs
+  path_dirs=(${^path}/*(/N:t))
+  (( ${#path_dirs} )) &&
+  _wanted path-dirs expl 'directory in path' compadd "$@" -a path_dirs && ret=0
+
+  if [[ $PREFIX$SUFFIX = */* ]]; then
+    # Find command from path, not hashed
+    _wanted commands expl 'external command' _path_files -W path -g '*(*)' &&
+    ret=0
+  fi
+fi
 
 return $ret
 }