24188fda800936b1abcbb37d9f9a7cff841215f8
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Merge pull request #1181 from paulmars/master
Plugin for git_remote_branch autocomplete.
Diff
1diff --git a/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
2new file mode 100644
3index 0000000000000000000000000000000000000000..ff98cbf87a296045abbff56082dfeae839f79dbf
4--- /dev/null
5+++ b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
6@@ -0,0 +1,18 @@
7+_git_remote_branch() {
8+ ref=$(git symbolic-ref HEAD 2> /dev/null)
9+ if [[ -n $ref ]]; then
10+ if (( CURRENT == 2 )); then
11+ # first arg: operation
12+ compadd create publish rename delete track
13+ elif (( CURRENT == 3 )); then
14+ # second arg: remote branch name
15+ compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
16+ elif (( CURRENT == 4 )); then
17+ # third arg: remote name
18+ compadd `git remote`
19+ fi
20+ else;
21+ _files
22+ fi
23+}
24+compdef _git_remote_branch grb