summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPaul McKellar <paul.mckellar@gmail.com>2012-06-18 01:01:05 -0700
committerPaul McKellar <paul.mckellar@gmail.com>2012-06-20 14:59:05 -0700
commit8088e8ac7935e9289d049278e117befd87f48809 (patch)
treeaa86f44c264f88a2e34df9ad178399bcb6cf6bcf /plugins
parente8d582aba98d57214a374bed01570ba791c54d9e (diff)
downloadzsh-8088e8ac7935e9289d049278e117befd87f48809.tar.gz
zsh-8088e8ac7935e9289d049278e117befd87f48809.tar.bz2
zsh-8088e8ac7935e9289d049278e117befd87f48809.zip
add git remote branch autocomplete
Diffstat (limited to 'plugins')
-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