-
Notifications
You must be signed in to change notification settings - Fork 284
/
Copy pathext.t
120 lines (102 loc) · 2.49 KB
/
ext.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Set up
$ alias hook=antigen-add-hook
Call hook any function.
$ hello () {
> echo Hello.
> }
$ hello-fr () {
> echo Bonjour.
> }
$ hook hello hello-fr replace
$ hello
Bonjour.
Fail to create hook function if hooked function doesn't exists.
$ help-fr () {
> echo Help.
> }
$ hook help help-fr replace
Antigen: Function help doesn't exist.
[1]
$ help
zsh: command not found: help
[127]
Fail to create hook function if hook function doesn't exists.
$ help () {
> echo Help.
> }
$ hook help help-de replace
Antigen: Function help-de doesn't exist.
[1]
$ help
Help.
Can create pre hook functions.
$ hola () {
> echo Hola.
> }
$ hola-en () {
> echo Hello.
> }
$ hook hola hola-en pre
$ hola
Hello.
Hola.
Can create post hook functions.
$ hola-pr () {
> echo Olá.
> }
$ hook hola hola-pr post
$ hola
Hello.
Hola.
Olá.
Can reset all hooks functions.
$ -antigen-reset-hooks
$ hola
Hola.
$ hook hola hola-en pre
$ hola
Hello.
Hola.
Can add multiple pre/post hook functions.
$ -antigen-reset-hooks
$ antigen-bundle () {
> echo called antigen-bundle with $@
> }
$ antigen-bundle desyncr/zsh-ctrlp --no-local-clone
called antigen-bundle with desyncr/zsh-ctrlp --no-local-clone
$ antigen-bundle-hook () {
> echo "pre-hook: $@"
> }
$ hook antigen-bundle antigen-bundle-hook pre
$ antigen-bundle-hook2 () {
> echo "pre-hook2: $@"
> }
$ hook antigen-bundle antigen-bundle-hook2 pre
$ antigen-bundle-hook-post () {
> echo "post-hook: $@"
> }
$ hook antigen-bundle antigen-bundle-hook-post post
$ antigen-bundle-hook-post2 () {
> echo "post-hook2: $@"
> }
$ hook antigen-bundle antigen-bundle-hook-post2 post
$ antigen-bundle example/bundle
pre-hook: example/bundle
pre-hook2: example/bundle
called antigen-bundle with example/bundle
post-hook: example/bundle
post-hook2: example/bundle
Example deferred function with hook.
$ -antigen-reset-hooks
$ typeset -a _bundle_deferred; _bundle_deferred=()
$ antigen-bundle-deferred () {
> _bundle_deferred+=($@)
> }
$ hook antigen-bundle antigen-bundle-deferred replace
$ antigen-bundle zsh-users/zsh-syntax-highlighting
$ antigen-bundle zsh-users/zsh-autocompletions
$ echo $_bundle_deferred
zsh-users/zsh-syntax-highlighting zsh-users/zsh-autocompletions
$ antigen-remove-hook antigen-bundle-deferred
$ antigen-bundle zsh-users/zsh-completions
called antigen-bundle with zsh-users/zsh-completions