summaryrefslogtreecommitdiffstats
path: root/contrib/completion/git-completion.zsh
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2014-01-05 11:18:03 +0100
committerJunio C Hamano <gitster@pobox.com>2014-01-06 18:14:48 +0100
commitf33c2c0f9e2258a80e6e406af39e9fa3fd6e430e (patch)
tree04e637b1497eb081e3cd04fc319b0470b1095e93 /contrib/completion/git-completion.zsh
parentzsh completion: find matching custom bash completion (diff)
downloadgit-f33c2c0f9e2258a80e6e406af39e9fa3fd6e430e.tar.xz
git-f33c2c0f9e2258a80e6e406af39e9fa3fd6e430e.zip
completion: introduce __gitcomp_nl_append ()
There are situations where multiple classes of completions possible. For example branch.<TAB> should try to complete branch.master. branch.autosetupmerge branch.autosetuprebase The first candidate has the suffix ".", and the second/ third candidates have the suffix " ". To facilitate completions of this kind, create a variation of __gitcomp_nl () that appends to the existing list of completion candidates, COMPREPLY. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion/git-completion.zsh')
-rw-r--r--contrib/completion/git-completion.zsh8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 6fca145c06..6b77968572 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -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