]> git.rmz.io Git - dotfiles.git/blob - zsh/plugins/git-remote-branch/git-remote-branch.plugin.zsh
ff98cbf87a296045abbff56082dfeae839f79dbf
[dotfiles.git] / zsh / plugins / git-remote-branch / git-remote-branch.plugin.zsh
1 _git_remote_branch() {
2 ref=$(git symbolic-ref HEAD 2> /dev/null)
3 if [[ -n $ref ]]; then
4 if (( CURRENT == 2 )); then
5 # first arg: operation
6 compadd create publish rename delete track
7 elif (( CURRENT == 3 )); then
8 # second arg: remote branch name
9 compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
10 elif (( CURRENT == 4 )); then
11 # third arg: remote name
12 compadd `git remote`
13 fi
14 else;
15 _files
16 fi
17 }
18 compdef _git_remote_branch grb