mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
unposted: vcs_info: Add an example of using $functions to find hooks by name.
This commit is contained in:
parent
a833fe4a18
commit
27a64a16fb
2 changed files with 15 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2019-12-02 Daniel Shahaf <danielsh@apache.org>
|
||||
|
||||
* unposted: Misc/vcs_info-examples: vcs_info: Add an example
|
||||
of using $functions to find hooks by name.
|
||||
|
||||
2019-12-01 Oliver Kiddle <okiddle@yahoo.co.uk>
|
||||
|
||||
* unposted: Completion/Unix/Command/_killall: another place
|
||||
|
|
|
@ -212,6 +212,16 @@ function +vi-git-remotebranch() {
|
|||
}
|
||||
|
||||
|
||||
### Derive hook names dynamically
|
||||
# With the following line:
|
||||
zstyle -e ':vcs_info:git+set-message:*' hooks 'reply=( ${${(k)functions[(I)[+]vi-git-set-message*]}#+vi-} )'
|
||||
# Any function named `+vi-git-set-message-<anything>' would be automatically
|
||||
# registered as a hook. For example:
|
||||
+vi-git-set-message-foo() {}
|
||||
+vi-git-set-message-bar() {}
|
||||
# Both of these functions would be called, even if they are defined after the zstyle is set.
|
||||
|
||||
|
||||
### hg: Show marker when the working directory is not on a branch head
|
||||
# This may indicate that running `hg up` will do something
|
||||
# NOTE: the branchheads.cache file is not updated with every Mercurial
|
||||
|
|
Loading…
Reference in a new issue