@@ -117,6 +117,7 @@ Module | Description
117
117
### Install modules for your own plugin
118
118
119
119
Use ` :Vitalize ` to install modules.
120
+ Assuming your Vim plugin name is ` your_plugin_name ` and plugin directory is ` your_plugin_dir ` .
120
121
Please see [ the help] ( doc/vitalizer.txt ) for more details.
121
122
122
123
``` vim
@@ -133,45 +134,61 @@ repository
133
134
134
135
### Use vital functions
135
136
136
- Assuming your Vim plugin name is ` ujihisa ` . You can define your utility
137
- function set ` ujihisa #util` just by
137
+ Assuming your Vim plugin name is ` your_plugin_name ` . You can define your utility
138
+ function set ` your_plugin_name #util` just by
138
139
139
140
``` vim
140
- let s:V = vital#ujihisa#new()
141
- function! ujihisa#util#system(...)
142
- return call(s:V.system, a:000, s:V)
141
+ let s:Process = vital#your_plugin_name#import('System.Process')
142
+
143
+ function! your_plugin_name#util#system(...)
144
+ return s:Process.execute(a:000)
143
145
endfunction
146
+ " run
147
+ " echo your_plugin_name#util#system('echo','abc')
148
+ " -> $ echo abc
144
149
```
145
150
146
- and then you can call functions by ` ujihisa #util#system()` , without taking care
151
+ and then you can call functions by ` your_plugin_name #util#system()` , without taking care
147
152
of ` vital.vim ` itself. It's all hidden.
148
153
149
154
Vital has module system. The below is an example to import/load a module
150
- ` Data.OrderedSet ` and to call a function ` f ()` of the module.
155
+ ` Math ` and to call a function ` lcm ()` of the module.
151
156
152
157
``` vim
153
158
" Recommended way
154
- let s:V = vital#ujihisa#new()
155
- let s:O = s:V.import('Data.OrderedSet')
156
- call s:O.f()
159
+ let s:M = vital#your_plugin_name#import('Math')
160
+ call s:M.lcm([2, 3, 4])
161
+ " -> 12
162
+ ```
163
+
164
+ or
165
+
166
+ ``` vim
167
+ " Alternative way
168
+ let s:V = vital#your_plugin_name#new()
169
+ let s:M = s:V.import('Math')
170
+ call s:M.lcm([2, 3, 4])
171
+ " -> 12
157
172
```
158
173
159
174
or
160
175
161
176
``` vim
162
- " Recommended way only if you rarely use the module
163
- let s:V = vital#ujihisa#new()
164
- call s:V.load('Data.OrderedSet')
165
- call s:V.Data.OrderedSet.f()
177
+ " Alternative way only if you rarely use the module
178
+ let s:V = vital#your_plugin_name#new()
179
+ call s:V.load('Math')
180
+ call s:V.Math.lcm([2, 3, 4])
181
+ " -> 12
166
182
```
167
183
168
184
or
169
185
170
186
``` vim
171
187
" Available, but we don't recommend this very much
172
- let s:V = vital#ujihisa#new()
173
- call s:V.import('Data.OrderedSet', s:)
174
- call s:f()
188
+ let s:V = vital#your_plugin_name#new()
189
+ call s:V.import('Math', s:)
190
+ call s:lcm([2, 3, 4])
191
+ " -> 12
175
192
```
176
193
177
194
We recommend you to use a capital letter for a Vital module dictionary to assign.
0 commit comments