36e29fbc193c32d14f0d63fbf6ae233a924b1d67

Author
Felipe Contreras <felipe.contreras@gmail.com>
Committer
Felipe Contreras <felipe.contreras@gmail.com>
Date

Message

completion: zsh: improve main function selection

Sometimes we want to use the function directly (e.g. _git_checkout), for
example when zsh has the option 'complete_aliases', this way, we can do
something like:

  compdef _git gco=git_checkout

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>

Diff

 1diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
 2index 7ed3e3c26e317b2352da0507c032d437a72d4000..6d1b4ecc70b305ea19da599960cb20a7627b62c9 100644
 3--- a/plugins/gitfast/_git
 4+++ b/plugins/gitfast/_git
 5@@ -214,8 +214,10 @@ _git ()
 6 
 7 	if (( $+functions[__${service}_zsh_main] )); then
 8 		__${service}_zsh_main
 9-	else
10+	elif (( $+functions[__${service}_main] )); then
11 		emulate ksh -c __${service}_main
12+	elif (( $+functions[_${service}] )); then
13+		emulate ksh -c _${service}
14 	fi
15 
16 	let _ret && _default && _ret=0