From 8b87aca62e72927ce2b466a60a3c0a8de8193edb Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 8 Jan 2012 16:04:38 +0000 Subject: users/16711: try to take account of PATH_DIRS option in command completion --- Completion/Unix/Type/_path_commands | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Completion/Unix/Type/_path_commands') 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 } -- cgit 1.4.1