@@ -117,61 +117,70 @@ 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 ` pluginname ` .
120
121
Please see [ the help] ( doc/vitalizer.txt ) for more details.
121
122
122
123
``` vim
123
- :Vitalize --name=your_plugin_name $HOME/.vim/bundle/your_plugin_dir /
124
+ :Vitalize --name=pluginname $HOME/.vim/bundle/pluginname /
124
125
```
125
126
126
127
You can also install only specified modules; recommended for making your
127
128
repository size small, assuming you are going to upload it to a remote
128
129
repository
129
130
130
131
``` vim
131
- :Vitalize --name=your_plugin_name $HOME/.vim/bundle/your_plugin_dir / Data.String Data.List
132
+ :Vitalize --name=pluginname $HOME/.vim/bundle/pluginname / Data.String Data.List
132
133
```
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 ` pluginname ` . You can define your utility
138
+ function set ` pluginname #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:V = vital#pluginname#new()
142
+ let s:process = s:V.import('System.Process')
143
+
144
+ function! pluginname#util#system(...)
145
+ return s:process.execute(a:000)
143
146
endfunction
147
+ " run
148
+ " echo pluginname#util#system('echo','abc')
149
+ " -> $ echo abc
144
150
```
145
151
146
- and then you can call functions by ` ujihisa #util#system()` , without taking care
152
+ and then you can call functions by ` pluginname #util#system()` , without taking care
147
153
of ` vital.vim ` itself. It's all hidden.
148
154
149
155
Vital has module system. The below is an example to import/load a module
150
156
` Data.OrderedSet ` and to call a function ` f() ` of the module.
151
157
152
158
``` vim
153
159
" Recommended way
154
- let s:V = vital#ujihisa#new()
155
- let s:O = s:V.import('Data.OrderedSet')
156
- call s:O.f()
160
+ let s:V = vital#pluginname#new()
161
+ let s:O = s:V.import('Math')
162
+ call s:O.lcm([2, 3, 4])
163
+ " -> 12
157
164
```
158
165
159
166
or
160
167
161
168
``` vim
162
169
" 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()
170
+ let s:V = vital#pluginname#new()
171
+ call s:V.load('Math')
172
+ call s:V.Math.lcm([2, 3, 4])
173
+ " -> 12
166
174
```
167
175
168
176
or
169
177
170
178
``` vim
171
179
" 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()
180
+ let s:V = vital#pluginname#new()
181
+ call s:V.import('Math', s:)
182
+ call s:lcm([2, 3, 4])
183
+ " -> 12
175
184
```
176
185
177
186
We recommend you to use a capital letter for a Vital module dictionary to assign.
0 commit comments