Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: completing commands
- X-seq: zsh-workers 19021
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: Re: completing commands
- Date: Wed, 03 Sep 2003 15:57:04 +0200
- In-reply-to: <25211.1062585848@xxxxxxx> 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <25211.1062585848@xxxxxxx>
Peter wrote:
> When I try to complete a command word with a path I often get,
> 
> Completing executable file or directory
> <list of directories>
> Completing directory
> <the same list of directories>
> 
> The second list comes from autocd --- it doesn't need to be the same
> list, because it can use cdpath, but often it is the same list because
> e.g. I typed ./ first.  Any thoughts about fixing this?  I suspect it's
> not trivial because it needs completion functions to be aware of one
> another.
In addition to that, it refuses to complete local directories in the
current directory.
There was some effort in _cd to handle the issue but it didn't go far
enough. I think this patch solves the problem.
Index: Completion/Zsh/Command/_cd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_cd,v
retrieving revision 1.6
diff -u -r1.6 _cd
--- Completion/Zsh/Command/_cd	30 Jan 2002 08:47:55 -0000	1.6
+++ Completion/Zsh/Command/_cd	3 Sep 2003 13:31:19 -0000
@@ -67,14 +67,15 @@
     # Don't complete local directories in command position, that's
     # already handled by _command_names (see _autocd)
 
-    [[ CURRENT -ne 1 ]] &&
+    [[ CURRENT -ne 1 || ( -z "$path[(r).]" && $PREFIX != */* ) ]] &&
         alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" )
 
     _alternative "$alt[@]" && ret=0
 
     return ret
   fi
-  _wanted directories expl directory _path_files -/ && ret=0
+  [[ CURRENT -ne 1 ]] && _wanted directories expl directory \
+      _path_files -/ && ret=0
 
   return ret
 fi
Messages sorted by:
Reverse Date,
Date,
Thread,
Author