@@ -36,35 +36,42 @@ Please read the docs of each module before using them.
36
36
==============================================================================
37
37
USAGE *Vital-usage*
38
38
39
- Assuming your Vim plugin name is "ujihisa", you can define your utility
40
- function set 'ujihisa #util' just by
39
+ Assuming your Vim plugin name is "pluginname". You can define your utility
40
+ function set "pluginname #util" just by
41
41
>
42
- let s:P = vital#ujihisa#new().import('Process')
43
- function! ujihisa#util#system(...)
44
- return call(s:P.system, a:000, s:P)
42
+ let s:V = vital#pluginname#new()
43
+ let s:process = s:V.import('System.Process')
44
+
45
+ function! pluginname#util#system(...)
46
+ return s:process.execute(a:000)
45
47
endfunction
46
48
<
47
- and then you can call functions by 'ujihisa #util#system()', without taking
49
+ and then you can call functions by 'pluginname #util#system()', without taking
48
50
care of | vital.vim | itself. It's all hidden.
49
51
50
52
| Vital | has module system. The below is an example to import/load a module
51
- "data/ordered_set " and to call a function "f ()" of the module.
53
+ "Math " and to call a function "lcm ()" of the module.
52
54
>
53
- let s:V = vital#ujihisa#new()
54
- let s:O = s:V.import('Data.OrderedSet')
55
- call s:O.f()
55
+ let s:M = vital#pluginname#import('Math')
56
+ call s:M.lcm([2, 3, 4])
56
57
<
57
58
or
58
59
>
59
- let s:V = vital#ujihisa #new()
60
- call s:V.load('Data.OrderedSet ')
61
- call s:V.Data.OrderedSet.f( )
60
+ let s:V = vital#pluginname #new()
61
+ let s:M = s:V.import('Math ')
62
+ call s:M.lcm([2, 3, 4] )
62
63
<
63
64
or
64
65
>
65
- let s:V = vital#ujihisa#new()
66
- call s:V.import('Data.OrderedSet', s:)
67
- call s:f()
66
+ let s:V = vital#pluginname#new()
67
+ call s:V.load('Math')
68
+ call s:V.Math.lcm([2, 3, 4])
69
+ <
70
+ or
71
+ >
72
+ let s:V = vital#pluginname#new()
73
+ call s:V.import('Math', s:)
74
+ call s:lcm([2, 3, 4])
68
75
<
69
76
We recommend you to use a capital letter for a Vital module dictionary to
70
77
assign as Vital convention. That makes your code more readable among Vital
0 commit comments