Unverified Commit 0232ac4b authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into master

parents afb02876 ebc700be
...@@ -4,7 +4,7 @@ Plugin for ForkLift, an FTP application for OS X. ...@@ -4,7 +4,7 @@ Plugin for ForkLift, an FTP application for OS X.
### Requirements ### Requirements
* [ForkLift](http://www.binarynights.com/forklift/) * [ForkLift](https://binarynights.com/)
### Usage ### Usage
......
# Open folder in ForkLift.app or ForkLift2.app from console # Open folder in ForkLift.app or ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift2 by Johan Kaving # Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
# #
# Usage: # Usage:
# fl [<folder>] # fl [<folder>]
...@@ -24,46 +24,84 @@ function fl { ...@@ -24,46 +24,84 @@ function fl {
fi fi
osascript 2>&1 1>/dev/null <<END osascript 2>&1 1>/dev/null <<END
try try
tell application "Finder" tell application "Finder"
set appName to name of application file id "com.binarynights.ForkLift2" set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
end tell end tell
on error err_msg number err_num on error err_msg number err_num
tell application "Finder" set forkLift3 to null
set appName to name of application file id "com.binarynights.ForkLift" end try
end tell try
end try tell application "Finder"
set forkLift2 to name of application file id "com.binarynights.ForkLift2"
end tell
on error err_msg number err_num
set forkLift2 to null
end try
try
tell application "Finder"
set forkLift to name of application file id "com.binarynights.ForkLift"
end tell
on error err_msg number err_num
set forkLift to null
end try
if application appName is running if forkLift3 is not null and application forkLift3 is running then
tell application appName tell application forkLift3
activate activate
end tell set forkLiftVersion to version
else end tell
tell application appName else if forkLift2 is not null and application forkLift2 is running then
tell application forkLift2
activate activate
end tell set forkLiftVersion to version
repeat until application appName is running end tell
delay 1 else if forkLift is not null and application forkLift is running then
end repeat tell application forkLift
tell application appName
activate activate
end tell set forkLiftVersion to version
end tell
else
if forkLift3 is not null then
set appName to forkLift3
else if forkLift2 is not null then
set appName to forkLift2
else if forkLift is not null then
set appName to forkLift
end if end if
tell application appName
activate
set forkLiftVersion to version
end tell
repeat until application appName is running
delay 1
end repeat
tell application appName
activate
end tell
end if
tell application "System Events" tell application "System Events"
tell application process "ForkLift" tell application process "ForkLift"
try try
set topWindow to window 1 set topWindow to window 1
on error on error
keystroke "n" using command down keystroke "n" using command down
set topWindow to window 1 set topWindow to window 1
end try end try
keystroke "g" using {command down, shift down} keystroke "g" using {command down, shift down}
tell sheet 1 of topWindow if forkLiftVersion starts with "3" then
set value of text field 1 to "$PWD" tell pop over of list of group of splitter group of splitter group of topWindow
keystroke return set value of text field 1 to "$PWD"
end tell end tell
end tell else
tell sheet 1 of topWindow
set value of text field 1 to "$PWD"
end tell
end if
keystroke return
end tell end tell
end tell
END END
} }
...@@ -32,16 +32,17 @@ Available search contexts are: ...@@ -32,16 +32,17 @@ Available search contexts are:
| context | URL | | context | URL |
|---------------|--------------------------------------------------------------------------| |---------------|--------------------------------------------------------------------------|
| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` | | angular(>=2.0)| `https://angular.io/?search=` |
| angularjs(1.x)| `https://google.com/search?as_sitesearch=angularjs.org&as_q=`
| aurajs | `http://aurajs.com/api/#stq=` | | aurajs | `http://aurajs.com/api/#stq=` |
| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` | | bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
| bootsnipp | `http://bootsnipp.com/search?q=` | | bootsnipp | `https://bootsnipp.com/search?q=` |
| caniuse | `http://caniuse.com/#search=` | | caniuse | `https://caniuse.com/#search=` |
| codepen | `http://codepen.io/search?q=` | | codepen | `https://codepen.io/search?q=` |
| compassdoc | `http://compass-style.org/search?q=` | | compassdoc | `http://compass-style.org/search?q=` |
| cssflow | `http://www.cssflow.com/search?q=` | | cssflow | `http://www.cssflow.com/search?q=` |
| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` | | dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
| emberjs | `http://emberjs.com/api/#stp=1&stq=` | | emberjs | `https://emberjs.com/api/#stp=1&stq=` |
| fontello | `http://fontello.com/#search=` | | fontello | `http://fontello.com/#search=` |
| html5please | `http://html5please.com/#` | | html5please | `http://html5please.com/#` |
| jquery | `https://api.jquery.com/?s=` | | jquery | `https://api.jquery.com/?s=` |
...@@ -51,7 +52,7 @@ Available search contexts are: ...@@ -51,7 +52,7 @@ Available search contexts are:
| qunit | `https://api.qunitjs.com/?s=` | | qunit | `https://api.qunitjs.com/?s=` |
| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` | | reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` | | smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
| stackoverflow | `http://stackoverflow.com/search?q=` | | stackoverflow | `https://stackoverflow.com/search?q=` |
| unheap | `http://www.unheap.com/?s=` | | unheap | `http://www.unheap.com/?s=` |
If you want to have another context, open an Issue and tell us! If you want to have another context, open an Issue and tell us!
...@@ -62,4 +63,4 @@ If you want to have another context, open an Issue and tell us! ...@@ -62,4 +63,4 @@ If you want to have another context, open an Issue and tell us!
**Wilson Mendes (willmendesneto)** **Wilson Mendes (willmendesneto)**
+ <https://plus.google.com/+WilsonMendes> + <https://plus.google.com/+WilsonMendes>
+ <https://twitter.com/willmendesneto> + <https://twitter.com/willmendesneto>
+ <http://github.com/willmendesneto> + <https://github.com/willmendesneto>
...@@ -33,7 +33,8 @@ function _frontend() { ...@@ -33,7 +33,8 @@ function _frontend() {
'unheap: Search in unheap website' 'unheap: Search in unheap website'
'bem: Search in BEM website' 'bem: Search in BEM website'
'smacss: Search in SMACSS website' 'smacss: Search in SMACSS website'
'angularjs: Search in Angular website' 'angular: Search in Angular website for Angular 2.x'
'angularjs: Search in Angular website for Angular 1.x'
'reactjs: Search in React website' 'reactjs: Search in React website'
'emberjs: Search in Ember website' 'emberjs: Search in Ember website'
'stackoverflow: Search in StackOverflow website' 'stackoverflow: Search in StackOverflow website'
...@@ -99,6 +100,9 @@ function _frontend() { ...@@ -99,6 +100,9 @@ function _frontend() {
smacss) smacss)
_describe -t points "Warp points" frontend_points && ret=0 _describe -t points "Warp points" frontend_points && ret=0
;; ;;
angular)
_describe -t points "Warp points" frontend_points && ret=0
;;
angularjs) angularjs)
_describe -t points "Warp points" frontend_points && ret=0 _describe -t points "Warp points" frontend_points && ret=0
;; ;;
......
alias angular='frontend angular'
alias angularjs='frontend angularjs' alias angularjs='frontend angularjs'
alias aurajs='frontend aurajs' alias aurajs='frontend aurajs'
alias bem='frontend bem' alias bem='frontend bem'
...@@ -26,16 +27,17 @@ function frontend() { ...@@ -26,16 +27,17 @@ function frontend() {
# define search context URLS # define search context URLS
typeset -A urls typeset -A urls
urls=( urls=(
angular 'https://angular.io/?search='
angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q=' angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
aurajs 'http://aurajs.com/api/#stq=' aurajs 'http://aurajs.com/api/#stq='
bem 'https://google.com/search?as_sitesearch=bem.info&as_q=' bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
bootsnipp 'http://bootsnipp.com/search?q=' bootsnipp 'https://bootsnipp.com/search?q='
caniuse 'http://caniuse.com/#search=' caniuse 'https://caniuse.com/#search='
codepen 'http://codepen.io/search?q=' codepen 'https://codepen.io/search?q='
compassdoc 'http://compass-style.org/search?q=' compassdoc 'http://compass-style.org/search?q='
cssflow 'http://www.cssflow.com/search?q=' cssflow 'http://www.cssflow.com/search?q='
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:' dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
emberjs 'http://emberjs.com/api/#stp=1&stq=' emberjs 'https://emberjs.com/api/#stp=1&stq='
fontello 'http://fontello.com/#search=' fontello 'http://fontello.com/#search='
html5please 'http://html5please.com/#' html5please 'http://html5please.com/#'
jquery 'https://api.jquery.com/?s=' jquery 'https://api.jquery.com/?s='
...@@ -45,7 +47,7 @@ function frontend() { ...@@ -45,7 +47,7 @@ function frontend() {
qunit 'https://api.qunitjs.com/?s=' qunit 'https://api.qunitjs.com/?s='
reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=' reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q=' smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
stackoverflow 'http://stackoverflow.com/search?q=' stackoverflow 'https://stackoverflow.com/search?q='
unheap 'http://www.unheap.com/?s=' unheap 'http://www.unheap.com/?s='
) )
...@@ -57,9 +59,9 @@ function frontend() { ...@@ -57,9 +59,9 @@ function frontend() {
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website," print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print -P "and %Ucontext%u is one of the following:" print -P "and %Ucontext%u is one of the following:"
print -P "" print -P ""
print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," print -P " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen,"
print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs," print -P " compassdoc, cssflow, dartlang, emberjs, fontello, html5please, jquery,"
print -P " qunit, reactjs, smacss, stackoverflow, unheap" print -P " lodash, mdn, npmjs, qunit, reactjs, smacss, stackoverflow, unheap"
print -P "" print -P ""
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)." print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
print -P "" print -P ""
...@@ -73,17 +75,17 @@ function frontend() { ...@@ -73,17 +75,17 @@ function frontend() {
echo "" echo ""
echo "Valid contexts are:" echo "Valid contexts are:"
echo "" echo ""
echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, " echo " angular (>= 2.0), angularjs (1.x), aurajs, bem, bootsnipp, caniuse, codepen,"
echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, " echo " compassdoc, cssflow, dartlang, emberjs, fontello, html5please, jquery,"
echo " qunit, reactjs, smacss, stackoverflow, unheap" echo " lodash, mdn, npmjs, qunit, reactjs, smacss, stackoverflow, unheap"
echo "" echo ""
return 1 return 1
fi fi
# build search url: # build search url:
# join arguments passed with '+', then append to search context URL # join arguments passed with '%20', then append to search context URL
# TODO substitute for proper urlencode method # TODO substitute for proper urlencode method
url="${urls[$1]}${(j:+:)@[2,-1]}" url="${urls[$1]}${(j:%20:)@[2,-1]}"
echo "Opening $url ..." echo "Opening $url ..."
......
# fzf
This plugin enables [junegunn's fzf](https://github.com/junegunn/fzf) fuzzy auto-completion and key bindings
```zsh
# Set fzf installation directory path
export FZF_BASE=/path/to/fzf/install/dir
# Uncomment the following line to disable fuzzy completion
# export DISABLE_FZF_AUTO_COMPLETION="true"
# Uncomment the following line to disable key bindings (CTRL-T, CTRL-R, ALT-C)
# export DISABLE_FZF_KEY_BINDINGS="true"
plugins=(
...
fzf
)
```
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
if [[ -z "${fzf_base}" ]]; then
fzfdirs=(
"${HOME}/.fzf"
"/usr/local/opt/fzf"
"/usr/share/fzf"
)
for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
break
fi
done
if [[ -z "${fzf_base}" ]]; then
if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
fi
fi
fi
fi
if [[ -n "${fzf_base}" ]]; then
# Fix fzf shell directory for Archlinux package
if [[ ! -d "${fzf_base}/shell" ]] && [[ -f /etc/arch-release ]]; then
fzf_shell="${fzf_base}"
else
fzf_shell="${fzf_base}/shell"
fi
# Setup fzf
# ---------
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
export PATH="$PATH:$fzf_base/bin"
fi
# Auto-completion
# ---------------
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
fi
# Key bindings
# ------------
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
source "${fzf_shell}/key-bindings.zsh"
fi
else
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
"Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
fi
unset fzf_base fzf_shell dir fzfdirs
## ZSH-Geeknote ## ZSH-Geeknote
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh). [Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
Plugins provides: Plugins provides:
......
# Gem plugin
This plugin adds completions and aliases for [Gem](https://rubygems.org/). The completions include the common `gem` subcommands as well as the installed gems in the current directory.
To use it, add `gem` to the plugins array in your zshrc file:
```zsh
plugins=(... gem)
```
## Aliases
| Alias | Command | Description |
|----------------------|-------------------------------|--------------------------------------------|
| gemb | `gem build *.gemspec` | Build a gem from a gemspec |
| gemp | `gem push *.gem` | Push a gem up to the gem server |
| gemy [gem] [version] | `gem yank [gem] -v [version]` | Remove a pushed gem version from the index |
# Git auto-fetch
Automatically fetches all changes from all remotes while you are working in git-initialized directory.
#### Usage
Add `git-auto-fetch` to the plugins array in your zshrc file:
```shell
plugins=(... git-auto-fetch)
```
Every time you launch a command in your shell all remotes will be fetched in background.
By default autofetch will be triggered only if last fetch was done at least 60 seconds ago.
You can change fetch interval in your .zshrc:
```
GIT_AUTO_FETCH_INTERVAL=1200 #in seconds
```
Log of `git fetch --all` will be saved into `.git/FETCH_LOG`
#### Toggle auto fetch per folder
If you are using mobile connection or for any other reason you can disable git-auto-fetch for any folder:
```shell
$ cd to/your/project
$ git-auto-fetch
disabled
$ git-auto-fetch
enabled
```
GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60}
function git-fetch-all {
(`git rev-parse --is-inside-work-tree 2>/dev/null` &&
dir=`git rev-parse --git-dir` &&
[[ ! -f $dir/NO_AUTO_FETCH ]] &&
(( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) &&
git fetch --all &>! $dir/FETCH_LOG &)
}
function git-auto-fetch {
`git rev-parse --is-inside-work-tree 2>/dev/null` || return
guard="`git rev-parse --git-dir`/NO_AUTO_FETCH"
(rm $guard 2>/dev/null &&
echo "${fg_bold[green]}enabled${reset_color}") ||
(touch $guard &&
echo "${fg_bold[red]}disabled${reset_color}")
}
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
function zle-line-init () {
git-fetch-all
override-git-auto-fetch-zle-line-init
}
zle -N zle-line-init
# git-extras # git-extras
This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras). This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
## Setup notes ## Setup notes
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for git-extras (http://github.com/tj/git-extras). # Completion script for git-extras (https://github.com/tj/git-extras).
# #
# This depends on and reuses some of the internals of the _git completion # This depends on and reuses some of the internals of the _git completion
# function that ships with zsh itself. It will not work with the _git that ships # function that ships with zsh itself. It will not work with the _git that ships
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
# Inspirations # Inspirations
# ----------- # -----------
# #
# * git-extras (http://github.com/tj/git-extras) # * git-extras (https://github.com/tj/git-extras)
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) # * git-flow-completion (https://github.com/bobthecow/git-flow-completion)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
...@@ -47,6 +47,14 @@ __gitex_commits() { ...@@ -47,6 +47,14 @@ __gitex_commits() {
_describe -t commits commit commits && ret=0 _describe -t commits commit commits && ret=0
} }
__gitex_remote_names() {
local expl
declare -a remote_names
remote_names=(${(f)"$(_call_program remotes git remote 2>/dev/null)"})
__git_command_successful || return
_wanted remote-names expl remote-name compadd $* - $remote_names
}
__gitex_tag_names() { __gitex_tag_names() {
local expl local expl
declare -a tag_names declare -a tag_names
...@@ -69,7 +77,11 @@ __gitex_specific_branch_names() { ...@@ -69,7 +77,11 @@ __gitex_specific_branch_names() {
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
__git_command_successful || return __git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd - $branch_names
}
__gitex_chore_branch_names() {
__gitex_specific_branch_names 'chore'
} }
__gitex_feature_branch_names() { __gitex_feature_branch_names() {
...@@ -102,6 +114,11 @@ __gitex_author_names() { ...@@ -102,6 +114,11 @@ __gitex_author_names() {
} }
# subcommands # subcommands
_git-authors() {
_arguments -C \
'(--list -l)'{--list,-l}'[show authors]' \
'--no-email[without email]' \
}
_git-bug() { _git-bug() {
local curcontext=$curcontext state line ret=1 local curcontext=$curcontext state line ret=1
...@@ -126,8 +143,16 @@ _git-bug() { ...@@ -126,8 +143,16 @@ _git-bug() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_bug_branch_names' ':branch-name:__gitex_bug_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
} }
...@@ -136,6 +161,40 @@ _git-changelog() { ...@@ -136,6 +161,40 @@ _git-changelog() {
'(-l --list)'{-l,--list}'[list commits]' \ '(-l --list)'{-l,--list}'[list commits]' \
} }
_git-chore() {
local curcontext=$curcontext state line ret=1
declare -A opt_args
_arguments -C \
': :->command' \
'*:: :->option-or-argument' && ret=0
case $state in
(command)
declare -a commands
commands=(
'finish:merge and delete the chore branch'
)
_describe -t commands command commands && ret=0
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(finish)
_arguments -C \
':branch-name:__gitex_chore_branch_names'
;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
return 0
esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-contrib() { _git-contrib() {
...@@ -149,6 +208,27 @@ _git-count() { ...@@ -149,6 +208,27 @@ _git-count() {
'--all[detailed commit count]' '--all[detailed commit count]'
} }
_git-create-branch() {
local curcontext=$curcontext state line
_arguments -C \
': :->command' \
'*:: :->option-or-argument'
case "$state" in
(command)
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac
esac
}
_git-delete-branch() { _git-delete-branch() {
_arguments \ _arguments \
...@@ -220,10 +300,17 @@ _git-feature() { ...@@ -220,10 +300,17 @@ _git-feature() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_feature_branch_names' ':branch-name:__gitex_feature_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
}
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
}
_git-graft() { _git-graft() {
_arguments \ _arguments \
...@@ -231,14 +318,39 @@ _git-graft() { ...@@ -231,14 +318,39 @@ _git-graft() {
':dest-branch-name:__gitex_branch_names' ':dest-branch-name:__gitex_branch_names'
} }
_git-guilt() {
_arguments -C \
'(--email -e)'{--email,-e}'[display author emails instead of names]' \
'(--ignore-whitespace -w)'{--ignore-whitespace,-w}'[ignore whitespace only changes]' \
'(--debug -d)'{--debug,-d}'[output debug information]' \
'-h[output usage information]'
}
_git-ignore() { _git-ignore() {
_arguments -C \ _arguments -C \
'(--local -l)'{--local,-l}'[show local gitignore]' \ '(--local -l)'{--local,-l}'[show local gitignore]' \
'(--global -g)'{--global,-g}'[show global gitignore]' '(--global -g)'{--global,-g}'[show global gitignore]' \
'(--private -p)'{--private,-p}'[show repo gitignore]'
} }
_git-ignore() {
_arguments -C \
'(--append -a)'{--append,-a}'[append .gitignore]' \
'(--replace -r)'{--replace,-r}'[replace .gitignore]' \
'(--list-in-table -l)'{--list-in-table,-l}'[print available types in table format]' \
'(--list-alphabetically -L)'{--list-alphabetically,-L}'[print available types in alphabetical order]' \
'(--search -s)'{--search,-s}'[search word in available types]'
}
_git-merge-into() {
_arguments '--ff-only[merge only fast-forward]'
_arguments \
':src:__gitex_branch_names' \
':dest:__gitex_branch_names'
}
_git-missing() { _git-missing() {
_arguments \ _arguments \
':first-branch-name:__gitex_branch_names' \ ':first-branch-name:__gitex_branch_names' \
...@@ -269,8 +381,16 @@ _git-refactor() { ...@@ -269,8 +381,16 @@ _git-refactor() {
_arguments -C \ _arguments -C \
':branch-name:__gitex_refactor_branch_names' ':branch-name:__gitex_refactor_branch_names'
;; ;;
-r|--remote )
_arguments -C \
':remote-name:__gitex_remote_names'
;;
esac esac
return 0
esac esac
_arguments \
'(--remote -r)'{--remote,-r}'[setup remote tracking branch]'
} }
...@@ -279,6 +399,23 @@ _git-squash() { ...@@ -279,6 +399,23 @@ _git-squash() {
':branch-name:__gitex_branch_names' ':branch-name:__gitex_branch_names'
} }
_git-stamp() {
_arguments -C \
'(--replace -r)'{--replace,-r}'[replace stamps with same id]'
}
_git-standup() {
_arguments -C \
'-a[Specify the author of commits. Use "all" to specify all authors.]' \
'-d[Show history since N days ago]' \
'-D[Specify the date format displayed in commit history]' \
'-f[Fetch commits before showing history]' \
'-g[Display GPG signed info]' \
'-h[Display help message]' \
'-L[Enable the inclusion of symbolic links]' \
'-m[The depth of recursive directory search]'
}
_git-summary() { _git-summary() {
_arguments '--line[summarize with lines rather than commits]' _arguments '--line[summarize with lines rather than commits]'
__gitex_commits __gitex_commits
...@@ -291,45 +428,71 @@ _git-undo(){ ...@@ -291,45 +428,71 @@ _git-undo(){
'(--hard -h)'{--hard,-h}'[wipes your commit(s)]' '(--hard -h)'{--hard,-h}'[wipes your commit(s)]'
} }
zstyle ':completion:*:*:git:*' user-commands \ zstyle -g existing_user_commands ':completion:*:*:git:*' user-commands
zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \
alias:'define, search and show aliases' \ alias:'define, search and show aliases' \
archive-file:'export the current HEAD of the git repository to a archive' \ archive-file:'export the current head of the git repository to an archive' \
authors:'generate authors report' \
back:'undo and stage latest commits' \ back:'undo and stage latest commits' \
bug:'create a bug branch' \ bug:'create bug branch' \
changelog:'populate changelog file with commits since the previous tag' \ bulk:'run bulk commands' \
commits-since:'list commits since a given date' \ changelog:'generate a changelog report' \
contrib:'display author contributions' \ chore:'create chore branch' \
count:'count commits' \ clear-soft:'soft clean up a repository' \
create-branch:'create local and remote branch' \ clear:'rigorously clean up a repository' \
delete-branch:'delete local and remote branch' \ commits-since:'show commit logs since some date' \
delete-merged-branches:'delete merged branches'\ contrib:'show user contributions' \
delete-submodule:'delete submodule' \ count:'show commit count' \
delete-tag:'delete local and remote tag' \ create-branch:'create branches' \
effort:'display effort statistics' \ delete-branch:'delete branches' \
extras:'git-extras' \ delete-merged-branches:'delete merged branches' \
feature:'create a feature branch' \ delete-submodule:'delete submodules' \
fork:'fork a repo on github' \ delete-tag:'delete tags' \
fresh-branch:'create empty local branch' \ delta:'lists changed files' \
gh-pages:'create the GitHub Pages branch' \ effort:'show effort statistics on file(s)' \
graft:'merge commits from source branch to destination branch' \ extras:'awesome git utilities' \
ignore:'add patterns to .gitignore' \ feature:'create/merge feature branch' \
info:'show info about the repository' \ force-clone:'overwrite local repositories with clone' \
local-commits:'list unpushed commits on the local branch' \ fork:'fork a repo on GitHub' \
fresh-branch:'create fresh branches' \
gh-pages:'create the GitHub pages branch' \
graft:'merge and destroy a given branch' \
guilt:'calculate change between two revisions' \
ignore-io:'get sample gitignore file' \
ignore:'add .gitignore patterns' \
info:'returns information on current repository' \
local-commits:'list local commits' \
lock:'lock a file excluded from version control' \ lock:'lock a file excluded from version control' \
locked:'ls files that have been locked' \ locked:'ls files that have been locked' \
merge-into:'merge one branch into another' \
merge-repo:'merge two repo histories' \
missing:'show commits missing from another branch' \ missing:'show commits missing from another branch' \
mr:'checks out a merge request locally' \
obliterate:'rewrite past commits to remove some files' \
pr:'checks out a pull request locally' \ pr:'checks out a pull request locally' \
psykorebase:'rebase a branch with a merge commit' \
pull-request:'create pull request to GitHub project' \
reauthor:'replace the author and/or committer identities in commits and tags' \
rebase-patch:'rebases a patch' \ rebase-patch:'rebases a patch' \
refactor:'create a refactor branch' \ refactor:'create refactor branch' \
release:'commit, tag and push changes to the repository' \ release:'commit, tag and push changes to the repository' \
rename-branch:'rename a branch' \
rename-tag:'rename a tag' \ rename-tag:'rename a tag' \
repl:'read-eval-print-loop' \ repl:'git read-eval-print-loop' \
reset-file:'reset one file' \ reset-file:'reset one file' \
root:'show path of root' \ root:'show path of root' \
setup:'setup a git repository' \ scp:'copy files to ssh compatible `git-remote`' \
sed:'replace patterns in git-controlled files' \
setup:'set up a git repository' \
show-merged-branches:'show merged branches' \
show-tree:'show branch tree of commit history' \ show-tree:'show branch tree of commit history' \
squash:'merge commits from source branch into the current one as a single commit' \ show-unmerged-branches:'show unmerged branches' \
summary:'repository summary' \ squash:'import changes from a branch' \
touch:'one step creation of new files' \ stamp:'stamp the last commit message' \
undo:'remove the latest commit' \ standup:'recall the commit history' \
summary:'show repository summary' \
sync:'sync local branch with remote branch' \
touch:'touch and add file to the index' \
undo:'remove latest commits' \
unlock:'unlock a file excluded from version control' unlock:'unlock a file excluded from version control'
# git-flow (AVH Edition) plugin
This plugin adds completion for the [git-flow (AVH Edition)](https://github.com/petervanderdoes/gitflow-avh).
The AVH Edition of the git extensions that provides high-level repository operations for [Vincent Driessen's branching model](https://nvie.com/posts/a-successful-git-branching-model/).
To use it, add `git-flow-avh` to the plugins array in your zshrc file:
```zsh
plugins=(... git-flow-avh)
```
## Requirements
1. The git-flow tool has to be [installed](https://github.com/petervanderdoes/gitflow-avh#installing-git-flow)
separately.
2. You have to use zsh's git completion instead of the git project's git completion. This is typically
done by default so you don't need to do anything else. If you installed git with Homebrew you
might have to uninstall the git completion it's bundled with.
#!zsh
#
# Installation
# ------------
#
# To achieve git-flow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest verion.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-flow-completion.zsh
#
# c. Or, use this file as a oh-my-zsh plugin.
#
_git-flow () _git-flow ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'init:Initialize a new git repo with support for the branching model.' 'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.' 'feature:Manage your feature branches.'
'config:Manage your configuration.' 'bugfix:Manage your bugfix branches.'
'release:Manage your release branches.' 'config:Manage your configuration.'
'hotfix:Manage your hotfix branches.' 'release:Manage your release branches.'
'support:Manage your support branches.' 'hotfix:Manage your hotfix branches.'
'version:Shows version information.' 'support:Manage your support branches.'
'finish:Finish the branch you are currently on.' 'version:Shows version information.'
'delete:Delete the branch you are currently on.' 'finish:Finish the branch you are currently on.'
'publish:Publish the branch you are currently on.' 'delete:Delete the branch you are currently on.'
) 'publish:Publish the branch you are currently on.'
_describe -t commands 'git flow' subcommands 'rebase:Rebase the branch you are currently on.'
;; )
_describe -t commands 'git flow' subcommands
(options) ;;
case $line[1] in
(options)
(init) case $line[1] in
_arguments \
-f'[Force setting of gitflow branches, even if already configured]' (init)
;; _arguments \
-f'[Force setting of gitflow branches, even if already configured]'
(version) ;;
;;
(version)
(hotfix) ;;
__git-flow-hotfix
;; (hotfix)
__git-flow-hotfix
(release) ;;
__git-flow-release
;; (release)
__git-flow-release
(feature) ;;
__git-flow-feature
;; (feature)
(config) __git-flow-feature
__git-flow-config ;;
;; (bugfix)
__git-flow-bugfix
esac ;;
;;
esac (config)
__git-flow-config
;;
esac
;;
esac
} }
__git-flow-release () __git-flow-release ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new release branch.' 'start:Start a new release branch.'
'finish:Finish a release branch.' 'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)' 'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish release branch to remote.' 'publish:Publish release branch to remote.'
'track:Checkout remote release branch.' 'track:Checkout remote release branch.'
'delete:Delete a release branch.' 'rebase:Rebase from integration branch.'
) 'delete:Delete a release branch.'
_describe -t commands 'git flow release' subcommands )
_arguments \ _describe -t commands 'git flow release' subcommands
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
;;
(options)
case $line[1] in (options)
case $line[1] in
(start)
_arguments \ (start)
-F'[Fetch from origin before performing finish]'\ _arguments \
':version:__git_flow_version_list' -F'[Fetch from origin before performing finish]'\
;; ':version:__git_flow_version_list'
;;
(finish)
_arguments \ (finish)
-F'[Fetch from origin before performing finish]' \ _arguments \
-s'[Sign the release tag cryptographically]'\ -F'[Fetch from origin before performing finish]' \
-u'[Use the given GPG-key for the digital signature (implies -s)]'\ -s'[Sign the release tag cryptographically]'\
-m'[Use the given tag message]'\ -u'[Use the given GPG-key for the digital signature (implies -s)]'\
-p'[Push to $ORIGIN after performing finish]'\ -m'[Use the given tag message]'\
':version:__git_flow_version_list' -p'[Push to $ORIGIN after performing finish]'\
;; ':version:__git_flow_version_list'
;;
(delete)
_arguments \ (delete)
-f'[Force deletion]' \ _arguments \
-r'[Delete remote branch]' \ -f'[Force deletion]' \
':version:__git_flow_version_list' -r'[Delete remote branch]' \
;; ':version:__git_flow_version_list'
;;
(publish)
_arguments \ (publish)
':version:__git_flow_version_list' _arguments \
;; ':version:__git_flow_version_list'
;;
(track)
_arguments \ (track)
':version:__git_flow_version_list' _arguments \
;; ':version:__git_flow_version_list'
;;
*)
_arguments \ (rebase)
-v'[Verbose (more) output]' _arguments \
;; -i'[Do an interactive rebase]' \
esac ':branch:__git_branch_names'
;; ;;
esac
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-hotfix () __git-flow-hotfix ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new hotfix branch.' 'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.' 'finish:Finish a hotfix branch.'
'delete:Delete a hotfix branch.' 'delete:Delete a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)' 'rebase:Rebase from integration branch.'
) 'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
_describe -t commands 'git flow hotfix' subcommands 'rename:Rename a hotfix branch.'
_arguments \ )
-v'[Verbose (more) output]' _describe -t commands 'git flow hotfix' subcommands
;; _arguments \
-v'[Verbose (more) output]'
(options) ;;
case $line[1] in
(options)
(start) case $line[1] in
_arguments \
-F'[Fetch from origin before performing finish]'\ (start)
':hotfix:__git_flow_version_list'\ _arguments \
':branch-name:__git_branch_names' -F'[Fetch from origin before performing finish]'\
;; ':hotfix:__git_flow_version_list'\
':branch-name:__git_branch_names'
(finish) ;;
_arguments \
-F'[Fetch from origin before performing finish]' \ (finish)
-s'[Sign the release tag cryptographically]'\ _arguments \
-u'[Use the given GPG-key for the digital signature (implies -s)]'\ -F'[Fetch from origin before performing finish]' \
-m'[Use the given tag message]'\ -s'[Sign the release tag cryptographically]'\
-p'[Push to $ORIGIN after performing finish]'\ -u'[Use the given GPG-key for the digital signature (implies -s)]'\
':hotfix:__git_flow_hotfix_list' -m'[Use the given tag message]'\
;; -p'[Push to $ORIGIN after performing finish]'\
':hotfix:__git_flow_hotfix_list'
(delete) ;;
_arguments \
-f'[Force deletion]' \ (delete)
-r'[Delete remote branch]' \ _arguments \
':hotfix:__git_flow_hotfix_list' -f'[Force deletion]' \
;; -r'[Delete remote branch]' \
':hotfix:__git_flow_hotfix_list'
*) ;;
_arguments \
-v'[Verbose (more) output]' (rebase)
;; _arguments \
esac -i'[Do an interactive rebase]' \
;; ':branch:__git_branch_names'
esac ;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-feature () __git-flow-feature ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'start:Start a new feature branch.' 'start:Start a new feature branch.'
'finish:Finish a feature branch.' 'finish:Finish a feature branch.'
'delete:Delete a feature branch.' 'delete:Delete a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)' 'list:List all your feature branches. (Alias to `git flow feature`)'
'publish:Publish feature branch to remote.' 'publish:Publish feature branch to remote.'
'track:Checkout remote feature branch.' 'track:Checkout remote feature branch.'
'diff:Show all changes.' 'diff:Show all changes.'
'rebase:Rebase from integration branch.' 'rebase:Rebase from integration branch.'
'checkout:Checkout local feature branch.' 'checkout:Checkout local feature branch.'
'pull:Pull changes from remote.' 'pull:Pull changes from remote.'
) 'rename:Rename a feature branch.'
_describe -t commands 'git flow feature' subcommands )
_arguments \ _describe -t commands 'git flow feature' subcommands
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
;;
(options)
case $line[1] in (options)
case $line[1] in
(start)
_arguments \ (start)
-F'[Fetch from origin before performing finish]'\ _arguments \
':feature:__git_flow_feature_list'\ -F'[Fetch from origin before performing finish]'\
':branch-name:__git_branch_names' ':feature:__git_flow_feature_list'\
;; ':branch-name:__git_branch_names'
;;
(finish)
_arguments \ (finish)
-F'[Fetch from origin before performing finish]' \ _arguments \
-r'[Rebase instead of merge]'\ -F'[Fetch from origin before performing finish]' \
':feature:__git_flow_feature_list' -r'[Rebase instead of merge]'\
;; ':feature:__git_flow_feature_list'
;;
(delete)
_arguments \ (delete)
-f'[Force deletion]' \ _arguments \
-r'[Delete remote branch]' \ -f'[Force deletion]' \
':feature:__git_flow_feature_list' -r'[Delete remote branch]' \
;; ':feature:__git_flow_feature_list'
;;
(publish)
_arguments \ (publish)
':feature:__git_flow_feature_list'\ _arguments \
;; ':feature:__git_flow_feature_list'\
;;
(track)
_arguments \ (track)
':feature:__git_flow_feature_list'\ _arguments \
;; ':feature:__git_flow_feature_list'\
;;
(diff)
_arguments \ (diff)
':branch:__git_branch_names'\ _arguments \
;; ':branch:__git_branch_names'\
;;
(rebase)
_arguments \ (rebase)
-i'[Do an interactive rebase]' \ _arguments \
':branch:__git_branch_names' -i'[Do an interactive rebase]' \
;; ':branch:__git_branch_names'
;;
(checkout)
_arguments \ (checkout)
':branch:__git_flow_feature_list'\ _arguments \
;; ':branch:__git_flow_feature_list'\
;;
(pull)
_arguments \ (pull)
':remote:__git_remotes'\ _arguments \
':branch:__git_branch_names' ':remote:__git_remotes'\
;; ':branch:__git_branch_names'
;;
*)
_arguments \ *)
-v'[Verbose (more) output]' _arguments \
;; -v'[Verbose (more) output]'
esac ;;
;; esac
esac ;;
esac
}
__git-flow-bugfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new bugfix branch.'
'finish:Finish a bugfix branch.'
'delete:Delete a bugfix branch.'
'list:List all your bugfix branches. (Alias to `git flow bugfix`)'
'publish:Publish bugfix branch to remote.'
'track:Checkout remote bugfix branch.'
'diff:Show all changes.'
'rebase:Rebase from integration branch.'
'checkout:Checkout local bugfix branch.'
'pull:Pull changes from remote.'
'rename:Rename a bugfix branch.'
)
_describe -t commands 'git flow bugfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':bugfix:__git_flow_bugfix_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Rebase instead of merge]'\
':bugfix:__git_flow_bugfix_list'
;;
(delete)
_arguments \
-f'[Force deletion]' \
-r'[Delete remote branch]' \
':bugfix:__git_flow_bugfix_list'
;;
(publish)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(track)
_arguments \
':bugfix:__git_flow_bugfix_list'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_flow_bugfix_list'\
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
} }
__git-flow-config () __git-flow-config ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
'*::options:->options' '*::options:->options'
case $state in case $state in
(command) (command)
local -a subcommands local -a subcommands
subcommands=( subcommands=(
'list:List the configuration. (Alias to `git flow config`)' 'list:List the configuration. (Alias to `git flow config`)'
'set:Set the configuration option' 'set:Set the configuration option'
) )
_describe -t commands 'git flow config' subcommands _describe -t commands 'git flow config' subcommands
;; ;;
(options) (options)
case $line[1] in case $line[1] in
(set) (set)
_arguments \ _arguments \
--local'[Use repository config file]' \ --local'[Use repository config file]' \
--global'[Use global config file]'\ --global'[Use global config file]'\
--system'[Use system config file]'\ --system'[Use system config file]'\
--file'[Use given config file]'\ --file'[Use given config file]'\
':option:(master develop feature hotfix release support versiontagprefix)' ':option:(master develop feature hotfix release support versiontagprefix)'
;; ;;
*) *)
_arguments \ _arguments \
--local'[Use repository config file]' \ --local'[Use repository config file]' \
--global'[Use global config file]'\ --global'[Use global config file]'\
--system'[Use system config file]'\ --system'[Use system config file]'\
--file'[Use given config file]' --file'[Use given config file]'
;; ;;
esac esac
;; ;;
esac esac
} }
__git_flow_version_list () __git_flow_version_list ()
{ {
local expl local expl
declare -a versions declare -a versions
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted versions expl 'version' compadd $versions _wanted versions expl 'version' compadd $versions
} }
__git_flow_feature_list () __git_flow_feature_list ()
{ {
local expl local expl
declare -a features declare -a features
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
}
__git_flow_bugfix_list ()
{
local expl
declare -a bugfixes
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) bugfixes=(${${(f)"$(_call_program bugfixes git flow bugfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted features expl 'feature' compadd $features _wanted bugfixes expl 'bugfix' compadd $bugfixes
} }
__git_remotes () { __git_remotes () {
local expl gitdir remotes local expl gitdir remotes
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return __git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return __git_command_successful || return
# TODO: Should combine the two instead of either or. # TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes _wanted remotes expl remote compadd $* - $remotes
else else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi fi
} }
__git_flow_hotfix_list () __git_flow_hotfix_list ()
{ {
local expl local expl
declare -a hotfixes declare -a hotfixes
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return __git_command_successful || return
_wanted hotfixes expl 'hotfix' compadd $hotfixes _wanted hotfixes expl 'hotfix' compadd $hotfixes
} }
__git_branch_names () { __git_branch_names () {
local expl local expl
declare -a branch_names declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return __git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names _wanted branch-names expl branch-name compadd $* - $branch_names
} }
__git_command_successful () { __git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository' _message 'not a git repository'
return 1 return 1
fi fi
return 0 return 0
} }
zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations' zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations'
...@@ -10,22 +10,23 @@ plugins=(... git-flow) ...@@ -10,22 +10,23 @@ plugins=(... git-flow)
## Aliases ## Aliases
More information about `git-flow` commands: More information about `git-flow` commands:
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
| Alias | Command | Description | | Alias | Command | Description |
|---------|---------------------------|----------------------------------------| |---------|----------------------------|----------------------------------------|
| `gfl` | `git flow` | Git-Flow command | | `gfl` | `git flow` | Git-Flow command |
| `gfli` | `git flow init` | Initialize git-flow repository | | `gfli` | `git flow init` | Initialize git-flow repository |
| `gcd` | `git checkout develop` | Check out develop branch | | `gcd` | `git checkout develop` | Check out develop branch |
| `gch` | `git checkout hotfix` | Check out hotfix branch | | `gch` | `git checkout hotfix` | Check out hotfix branch |
| `gcr` | `git checkout release` | Check out release branch | | `gcr` | `git checkout release` | Check out release branch |
| `gflf` | `git flow feature` | List existing feature branches | | `gflf` | `git flow feature` | List existing feature branches |
| `gflh` | `git flow hotfix` | List existing hotfix branches | | `gflh` | `git flow hotfix` | List existing hotfix branches |
| `gflr` | `git flow release` | List existing release branches | | `gflr` | `git flow release` | List existing release branches |
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` | | `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` | | `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` | | `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` | | `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` | | `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` | | `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
...@@ -33,6 +33,7 @@ alias gflfs='git flow feature start' ...@@ -33,6 +33,7 @@ alias gflfs='git flow feature start'
alias gflhs='git flow hotfix start' alias gflhs='git flow hotfix start'
alias gflrs='git flow release start' alias gflrs='git flow release start'
alias gflff='git flow feature finish' alias gflff='git flow feature finish'
alias gflfp='git flow feature publish'
alias gflhf='git flow hotfix finish' alias gflhf='git flow hotfix finish'
alias gflrf='git flow release finish' alias gflrf='git flow release finish'
alias gflfp='git flow feature publish' alias gflfp='git flow feature publish'
......
# git-hubflow plugin
This plugin adds completion for [HubFlow](https://datasift.github.io/gitflow/) (GitFlow for GitHub), as well as some
aliases for common commands. HubFlow is a git extension to make it easy to use GitFlow with GitHub. Based on the
original gitflow extension for git.
The hubflow tool has to be [installed](https://github.com/datasift/gitflow#installation) separately.
To use it, add `git-hubflow` to the plugins array in your zshrc file:
```zsh
plugins=(... git-hubflow)
```
## Aliases
| Alias | Command | Description |
|-------|------------------|------------------------------------------------------------------|
| ghf | `git hf` | Print command overview |
| ghff | `git hf feature` | Manage your feature branches |
| ghfr | `git hf release` | Manage your release branches |
| ghfh | `git hf hotfix` | Manage your hotfix branches |
| ghfs | `git hf support` | Manage your support branches |
| ghfu | `git hf update` | Pull upstream changes down into your master and develop branches |
#!zsh
#
# Installation
# ------------
#
# To achieve git-hubflow completion nirvana:
#
# 0. Update your zsh's git-completion module to the newest version.
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
#
# 1. Install this file. Either:
#
# a. Place it in your .zshrc:
#
# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in
# your .zshrc:
#
# source ~/.git-hubflow-completion.zsh
#
# c. Or, use this file as an oh-my-zsh plugin.
#
alias ghf='git hf' alias ghf='git hf'
alias ghff='git hf feature' alias ghff='git hf feature'
alias ghfr='git hf release' alias ghfr='git hf release'
...@@ -97,8 +75,8 @@ __git-hf-release () ...@@ -97,8 +75,8 @@ __git-hf-release ()
'finish:Finish a release branch.' 'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git hf release`)' 'list:List all your release branches. (Alias to `git hf release`)'
'cancel:Cancel release' 'cancel:Cancel release'
'push:Push release to github' 'push:Push release to GitHub'
'pull:Pull release from github' 'pull:Pull release from GitHub'
'track:Track release' 'track:Track release'
) )
_describe -t commands 'git hf release' subcommands _describe -t commands 'git hf release' subcommands
...@@ -155,8 +133,8 @@ __git-hf-hotfix () ...@@ -155,8 +133,8 @@ __git-hf-hotfix ()
'list:List all your hotfix branches. (Alias to `git hf hotfix`)' 'list:List all your hotfix branches. (Alias to `git hf hotfix`)'
'publish:Publish the hotfix branch.' 'publish:Publish the hotfix branch.'
'track:Track the hotfix branch.' 'track:Track the hotfix branch.'
'pull:Pull the hotfix from github.' 'pull:Pull the hotfix from GitHub.'
'push:Push the hotfix to github.' 'push:Push the hotfix to GitHub.'
'cancel:Cancel the hotfix.' 'cancel:Cancel the hotfix.'
) )
_describe -t commands 'git hf hotfix' subcommands _describe -t commands 'git hf hotfix' subcommands
...@@ -217,8 +195,8 @@ __git-hf-feature () ...@@ -217,8 +195,8 @@ __git-hf-feature ()
'diff:Diff' 'diff:Diff'
'rebase:Rebase feature branch against develop' 'rebase:Rebase feature branch against develop'
'checkout:Checkout feature' 'checkout:Checkout feature'
'pull:Pull feature branch from github' 'pull:Pull feature branch from GitHub'
'push:Push feature branch to github' 'push:Push feature branch to GitHub'
'cancel:Cancel feature' 'cancel:Cancel feature'
) )
_describe -t commands 'git hf feature' subcommands _describe -t commands 'git hf feature' subcommands
......
# git-prompt plugin
A `zsh` prompt that displays information about the current git repository. In particular:
the branch name, difference with remote branch, number of files staged or changed, etc.
To use it, add `git-prompt` to the plugins array in your zshrc file:
```zsh
plugins=(... git-prompt)
```
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Examples
The prompt may look like the following:
- `(master↑3|✚1)`: on branch `master`, ahead of remote by 3 commits, 1 file changed but not staged
- `(status|●2)`: on branch `status`, 2 files staged
- `(master|✚7…)`: on branch `master`, 7 files changed, some files untracked
- `(master|✖2✚3)`: on branch `master`, 2 conflicts, 3 files changed
- `(experimental↓2↑3|✔)`: on branch `experimental`; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean
- `(:70c2952|✔)`: not on any branch; parent commit has hash `70c2952`; the repository is otherwise clean
## Prompt Structure
By default, the general appearance of the prompt is:
```
(<branch><branch tracking>|<local status>)
```
The symbols are as follows:
### Local Status Symbols
| Symbol | Meaning |
|--------|--------------------------------|
| ✔ | repository clean |
| ●n | there are `n` staged files |
| ✖n | there are `n` unmerged files |
| ✚n | there are `n` unstaged files |
| … | there are some untracked files |
### Branch Tracking Symbols
| Symbol | Meaning |
|--------|---------------------------------------------------------------|
| ↑n | ahead of remote by `n` commits |
| ↓n | behind remote by `n` commits |
| ↓m↑n | branches diverged: other by `m` commits, yours by `n` commits |
## Customisation
- Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching.
- You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`)
to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)`
to see what variables are available.
**Enjoy!**
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment