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

Re: PATCH: partly rewriting alias handling in _git



On Mon, Sep 01, 2008 at 08:06:42PM +0200, Frank Terbeck wrote:
>     % git c  --some args
>            ^- place the cursor here and hit <tab>.
> 
> That does not return completions like 'commit'.

Try this.

Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.96
diff -u -r1.96 _git
--- Completion/Unix/Command/_git	1 Sep 2008 18:49:33 -0000	1.96
+++ Completion/Unix/Command/_git	1 Sep 2008 19:19:59 -0000
@@ -4307,15 +4307,15 @@
     '(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \
     '--git-dir=-[path to repository]:directory:_directories' \
     '--bare[use $PWD as repository]' \
-    ':command:->command' \
-    '*::options:->options' && ret=0
+    '*::arg:->cmd_or_options' && return
   case $state in
-    (command)
-      __git_aliases_and_commands
-      ;;
-    (options)
-      curcontext="${curcontext%:*:*}:git-$words[1]:"
-      _call_function ret _git-$words[1]
+    (cmd_or_options)
+      if (( CURRENT == 1 )); then
+        __git_aliases_and_commands
+      else
+        curcontext="${curcontext%:*:*}:git-$words[1]:"
+        _call_function ret _git-$words[1]
+      fi
       ;;
   esac
 else



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