Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _command_names and path



Clint Adams wrote:

> > Probably changing _command_names to use `_files -P/ -W/ ...' if `.' is
> > not in $path.
> 
> ...
> +
> +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

I've been thinking about this, too, at the weekend. We need to
complete files after things like `./<TAB>', too.

So we can make this slightly simpler.

Bye
  Sven

Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_command_names,v
retrieving revision 1.4
diff -u -r1.4 _command_names
--- Completion/Zsh/Type/_command_names	2002/01/27 21:57:54	1.4
+++ Completion/Zsh/Type/_command_names	2002/01/28 16:31:03
@@ -10,15 +10,10 @@
   'commands:external command:compadd -k commands'
 )
 
-if [[ -n "$path[(r).]" ]]; then
+[[ -n "$path[(r).]" || $PREFIX = */* ]] &&
   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

-- 
Sven Wischnowsky                           wischnow@xxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author