diff options
author | Robby Russell <robby@planetargon.com> | 2012-11-25 11:35:24 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2012-11-25 11:35:24 -0800 |
commit | fdfc0b3cd966012c347a17b2352feb5f1574419d (patch) | |
tree | 0ad8c17537db338869363c23ada1513a9382c130 /plugins/gitfast/_git | |
parent | c2ae9e09ca1f33ff1e13e629a0b2e6bdd19f83a9 (diff) | |
parent | 5a11228e93c667dd6d1cc87ec385ddf39d9e4726 (diff) | |
download | zsh-fdfc0b3cd966012c347a17b2352feb5f1574419d.tar.gz zsh-fdfc0b3cd966012c347a17b2352feb5f1574419d.tar.bz2 zsh-fdfc0b3cd966012c347a17b2352feb5f1574419d.zip |
Merge pull request #1417 from felipec/fc-git-upstream
Add gifast plugin
Diffstat (limited to 'plugins/gitfast/_git')
-rw-r--r-- | plugins/gitfast/_git | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git new file mode 100644 index 000000000..45775021f --- /dev/null +++ b/plugins/gitfast/_git @@ -0,0 +1,78 @@ +#compdef git gitk + +# zsh completion wrapper for git +# +# You need git's bash completion script installed somewhere, by default on the +# same directory as this script. +# +# If your script is on ~/.git-completion.sh instead, you can configure it on +# your ~/.zshrc: +# +# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh +# +# The recommended way to install this script is to copy to +# '~/.zsh/completion/_git', and then add the following to your ~/.zshrc file: +# +# fpath=(~/.zsh/completion $fpath) + +complete () +{ + # do nothing + return 0 +} + +zstyle -s ":completion:*:*:git:*" script script +test -z "$script" && script="$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash +ZSH_VERSION='' . "$script" + +__gitcomp () +{ + emulate -L zsh + + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + c="$c${4-}" + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + array+=("$c") + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + esac +} + +__gitcomp_nl () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 +} + +_git () +{ + local _ret=1 + () { + emulate -L ksh + local cur cword prev + cur=${words[CURRENT-1]} + prev=${words[CURRENT-2]} + let cword=CURRENT-1 + __${service}_main + } + let _ret && _default -S '' && _ret=0 + return _ret +} + +_git |