forked from aspiers/git-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_git_shortcuts
executable file
·47 lines (44 loc) · 1.5 KB
/
_git_shortcuts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#compdef gga ggb ggbmv ggci ggco ggd ggh ggk ggl ggmv ggr ggrb ggrbi ggrl ggs ggt
# Note that as of 4.3.4 there is a bug in _git that the invocation of
# _call_function to the helper function for the specific command (such
# as _git-branch) happens before the helper function has actually been
# defined. So the first time you hit TAB, _call_function fails but
# the helper function gets defined straight after the failure, so that
# when you hit TAB again it works.
case "$service" in
gga) git_fn=add ;;
ggb) git_fn=branch ;;
ggbmv) git_fn=branch ;;
ggci) git_fn=commit ;;
ggco) git_fn=checkout ;;
ggd) git_fn=diff ;;
# ggde) git_fn=describe ;;
ggk) git_fn=log ;;
ggl) git_fn=log ;;
ggmv) git_fn=mv ;;
ggr) git_fn=reset ;;
ggre) git_fn=remote ;;
ggrp) git_fn=rev-parse ;;
ggrb|ggrbi)
git_fn=rebase ;;
# ggrl) git_fn=reflog ;;
# ggrm) git_fn=rm ;;
ggs) git_fn=status ;;
# ggsh) git_fn=show ;;
ggt) git_fn=tag ;;
*) echo "BUG in _git_shortcuts: $service not supported"; return 1 ;;
esac
if true; then
# Simple way
service=git-$git_fn
words[1]=$service
_git "$@"
else
# Grr... can't get this way to work. Eventually _arguments calls
# comparguments which seems to get confused, perhaps by the change
# of the number of words, and we end up with 'no more arguments'.
words[1,2]=(git $git_fn)
CURRENT=3
_normal "$@"
#_dispatch -s git git /usr/bin/git -default-
fi