summaryrefslogtreecommitdiff
path: root/plugins/git-remote-branch
diff options
context:
space:
mode:
authorSébastien M-B <essembeh@gmail.com>2013-02-08 19:08:06 +0100
committerSébastien M-B <essembeh@gmail.com>2013-02-08 19:08:06 +0100
commit2595484a97d85496fdcdca99a23f52eecd9b1b43 (patch)
treefffe23d53a2a635f0861047fb058c8a2632414f7 /plugins/git-remote-branch
parent8d23a3611086e9a13e7ad754c57fa8cc4797bfa9 (diff)
parent6e6cf4303712befb5a7fc3918494aefe4a65991f (diff)
downloadzsh-2595484a97d85496fdcdca99a23f52eecd9b1b43.tar.gz
zsh-2595484a97d85496fdcdca99a23f52eecd9b1b43.tar.bz2
zsh-2595484a97d85496fdcdca99a23f52eecd9b1b43.zip
Merge remote-tracking branch 'upstream/master'
Conflicts: lib/aliases.zsh
Diffstat (limited to 'plugins/git-remote-branch')
-rw-r--r--plugins/git-remote-branch/git-remote-branch.plugin.zsh18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
new file mode 100644
index 000000000..ff98cbf87
--- /dev/null
+++ b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
@@ -0,0 +1,18 @@
+_git_remote_branch() {
+ ref=$(git symbolic-ref HEAD 2> /dev/null)
+ if [[ -n $ref ]]; then
+ if (( CURRENT == 2 )); then
+ # first arg: operation
+ compadd create publish rename delete track
+ elif (( CURRENT == 3 )); then
+ # second arg: remote branch name
+ compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
+ elif (( CURRENT == 4 )); then
+ # third arg: remote name
+ compadd `git remote`
+ fi
+ else;
+ _files
+ fi
+}
+compdef _git_remote_branch grb