This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #compdef gga ggb ggci ggco ggd ggh ggk ggl ggmv ggr ggrb 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 ;; | |
| ggci) git_fn=commit ;; | |
| ggco) git_fn=checkout ;; | |
| ggd) git_fn=diff ;; | |
| # ggde) git_fn=describe ;; | |
| ggl) git_fn=log ;; | |
| ggmv) git_fn=mv ;; | |
| ggr) git_fn=reset ;; | |
| ggrb) 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment