Merge branch 'jk/ansi-color'
[gitweb.git] / contrib / completion / git-completion.zsh
index fac5e711ebbbd074366d89848165e0f9dbc36c36..e25541308a1c269285a26b205d2d9990a789060a 100644 (file)
@@ -9,7 +9,7 @@
 #
 # If your script is somewhere else, you can configure it on your ~/.zshrc:
 #
-#  zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
+#  zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
 #
 # The recommended way to install this script is to copy to '~/.zsh/_git', and
 # then add the following to your ~/.zshrc file:
@@ -30,10 +30,10 @@ if [ -z "$script" ]; then
        local -a locations
        local e
        locations=(
+               $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
                '/etc/bash_completion.d/git' # fedora, old debian
                '/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
                '/usr/share/bash-completion/git' # gentoo
-               $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
                )
        for e in $locations; do
                test -f $e && script="$e" && break
@@ -76,6 +76,14 @@ __gitcomp_nl ()
        compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
 }
 
+__gitcomp_nl_append ()
+{
+       emulate -L zsh
+
+       local IFS=$'\n'
+       compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
+}
+
 __gitcomp_file ()
 {
        emulate -L zsh
@@ -96,6 +104,7 @@ __git_zsh_bash_func ()
 
        local expansion=$(__git_aliased_command "$command")
        if [ -n "$expansion" ]; then
+               words[1]=$expansion
                completion_func="_git_${expansion//-/_}"
                declare -f $completion_func >/dev/null && $completion_func
        fi