From: "Mikael Magnusson" <mikachu@gmail.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: A stab at better git-show completion
Date: Fri, 19 Oct 2007 03:44:43 +0200 [thread overview]
Message-ID: <237967ef0710181844o71d08aa0tc2f8158f504e6ed7@mail.gmail.com> (raw)
I decided i want to get very confused, so i decided to try and make
git-show completion allow
completing of the form commit:path/file where the path/file part
depends on what commit you
typed. Somehow i succeeded. (the [1,-2] is for removing the trailing colon)
http://git.mikachu.ath.cx/?p=zsh-cvs.git;a=commitdiff_plain;h=gitshow
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1010,11 +1010,25 @@ _git-show-ref () {
(( $+functions[_git-show] )) ||
_git-show () {
+ local curcontext=$curcontext state line
__git_setup_revision_arguments
_arguments -S \
$revision_arguments \
- '*:object:__git_revisions' && ret=0
+ '*:object:->object' && ret=0
+
+ case $state in
+ (object)
+ compset -P '*:'
+ if [[ -n $IPREFIX ]]; then
+ __git_tree_files $IPREFIX[1,-2]
+ else
+ _alternative \
+ 'revisions:revision:__git_revisions' \
+ 'files:file:__git_files'
+ fi
+ ;;
+ esac
}
(( $+functions[_git-show-index] )) ||
--
Mikael Magnusson
next reply other threads:[~2007-10-19 1:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-19 1:44 Mikael Magnusson [this message]
2007-10-19 2:24 ` Clint Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=237967ef0710181844o71d08aa0tc2f8158f504e6ed7@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).