about summary refs log tree commit diff
path: root/Completion/Zsh
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Zsh')
-rw-r--r--Completion/Zsh/Command/_zstyle3
-rw-r--r--Completion/Zsh/Context/_brace_parameter2
-rw-r--r--Completion/Zsh/Function/_vcs_info31
-rw-r--r--Completion/Zsh/Type/_vcs_info_hooks2
4 files changed, 34 insertions, 4 deletions
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 7db73c0c0..07b60605f 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -5,9 +5,6 @@ local nm=$compstate[nmatches] taglist patterns contexts MATCH
 integer MBEGIN MEND
 typeset -A opt_args styles
 
-_vcs_info_hooks() {
-  compadd - ${functions[(I)+vi-*]#+vi-}
-}
 # Assoc array of styles; the values give the possible top-level
 # contexts:
 #   c   completion
diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter
index c6e74bf7b..6960cec9b 100644
--- a/Completion/Zsh/Context/_brace_parameter
+++ b/Completion/Zsh/Context/_brace_parameter
@@ -38,7 +38,7 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then
 	case $char in
 	  (g)
 	  compset -P '*'
-	  flags=('o:octal escapes' 'c:expand ^X etc.' 'e:expand \M-t etc.')
+	  flags=('o:octal escapes' 'c:expand ^X etc.' 'e:expand \\M-t etc.')
 	  _describe -t format 'format option' flags -Q -S ''
 	  ;;
 
diff --git a/Completion/Zsh/Function/_vcs_info b/Completion/Zsh/Function/_vcs_info
new file mode 100644
index 000000000..fdb28de6a
--- /dev/null
+++ b/Completion/Zsh/Function/_vcs_info
@@ -0,0 +1,31 @@
+#compdef vcs_info_hookadd vcs_info_hookdel
+
+local -a hook_types=(
+  gen-applied-string
+  gen-hg-bookmark-string
+  gen-mqguards-string
+  gen-unapplied-string
+  no-vcs
+  post-backend
+  post-quilt
+  pre-addon-quilt
+  pre-get-data
+  set-branch-format
+  set-hgrev-format
+  set-message
+  set-patch-format
+  start-up
+)
+
+local -a specs
+case $service in
+  (vcs_info_hookdel)
+    specs=( '-a[remove all occurrences, not just the first]' )
+    ;;
+esac
+
+# TODO: for vcs_info_hookdel complete only functions installed for that hook
+_arguments : \
+  $specs \
+  ":hook type:($hook_types)" \
+  '*:hook function:_vcs_info_hooks'
diff --git a/Completion/Zsh/Type/_vcs_info_hooks b/Completion/Zsh/Type/_vcs_info_hooks
new file mode 100644
index 000000000..bad915000
--- /dev/null
+++ b/Completion/Zsh/Type/_vcs_info_hooks
@@ -0,0 +1,2 @@
+#autoload
+compadd - ${functions[(I)+vi-*]#+vi-}