about summary refs log tree commit diff
path: root/Functions/VCS_Info/vcs_info_hookadd
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/VCS_Info/vcs_info_hookadd')
-rw-r--r--Functions/VCS_Info/vcs_info_hookadd22
1 files changed, 22 insertions, 0 deletions
diff --git a/Functions/VCS_Info/vcs_info_hookadd b/Functions/VCS_Info/vcs_info_hookadd
new file mode 100644
index 000000000..867f7e271
--- /dev/null
+++ b/Functions/VCS_Info/vcs_info_hookadd
@@ -0,0 +1,22 @@
+## vim:ft=zsh
+## Written by Frank Terbeck <ft@bewatermyfriend.org>
+## Distributed under the same BSD-ish license as zsh itself.
+
+emulate -L zsh
+setopt extendedglob
+
+if (( ${#argv} < 2 )); then
+    print 'usage: vcs_info_hookadd <HOOK> <FUNCTION(s)...>'
+    return 1
+fi
+
+local hook func context
+local -a old
+
+hook=$1
+shift
+context=":vcs_info-static_hooks:${hook}"
+
+zstyle -a "${context}" hooks old
+zstyle "${context}" hooks "${old[@]}" "$@"
+return $?