Skip to content

Commit fea2183

Browse files
committed
README: update vim example that to be working.
1 parent 5c2b161 commit fea2183

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

README.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,61 +117,70 @@ Module | Description
117117
### Install modules for your own plugin
118118

119119
Use `:Vitalize` to install modules.
120+
Assuming your Vim plugin name is `pluginname`.
120121
Please see [the help](doc/vitalizer.txt) for more details.
121122

122123
```vim
123-
:Vitalize --name=your_plugin_name $HOME/.vim/bundle/your_plugin_dir/
124+
:Vitalize --name=pluginname $HOME/.vim/bundle/pluginname/
124125
```
125126

126127
You can also install only specified modules; recommended for making your
127128
repository size small, assuming you are going to upload it to a remote
128129
repository
129130

130131
```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
132133
```
133134

134135
### Use vital functions
135136

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
138139

139140
```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)
143146
endfunction
147+
" run
148+
" echo pluginname#util#system('echo','abc')
149+
" -> $ echo abc
144150
```
145151

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
147153
of `vital.vim` itself. It's all hidden.
148154

149155
Vital has module system. The below is an example to import/load a module
150156
`Data.OrderedSet` and to call a function `f()` of the module.
151157

152158
```vim
153159
" 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
157164
```
158165

159166
or
160167

161168
```vim
162169
" 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
166174
```
167175

168176
or
169177

170178
```vim
171179
" 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
175184
```
176185

177186
We recommend you to use a capital letter for a Vital module dictionary to assign.

0 commit comments

Comments
 (0)