Commits

ZyX_I  committed 1133a68

Added frawor#Setup function

  • Participants
  • Parent commits a2531e8

Comments (0)

Files changed (2)

File autoload/frawor.vim

+function frawor#Setup(version, dependencies, oneload)
+    if type(a:version)==type("")
+        let ver=map(split(a:version, '\.'), '+v:val')
+    else
+        let ver=a:version
+    endif
+    let deps=map(copy(a:dependencies),
+                \'((type(v:val)==type(""))?'.
+                \   '(map(split(v:val, "\\."), "+v:val")):'.
+                \   '(v:val))')
+    let expr='+matchstr(expand("<sfile>"), ''\d\+'')'
+    return       'execute "function s:Eval(expr)\n'.
+                \         '    return eval(a:expr)\n'.
+                \         "endfunction\"\n".
+                \"let s:g={}\n".
+                \"let s:F={}\n".
+                \"let s:g._frawor=FraworRegister(".string(ver).", ".
+                \                               "s:Eval(".string(expr)."), ".
+                \                               "expand('<sfile>:p'), ".
+                \                                string(deps).", ".
+                \                               (!!a:oneload).", s:g, s:F)"
+endfunction
+

File doc/frawor.txt

 2. Functionality provided                               *frawor-functionality*
 
 Frawor provides the only global function |FraworRegister()| (and 
-|frawor#FraworSetup()| that is wrapper around |FraworRegister()| and just 
+|frawor#Setup()| that is wrapper around |FraworRegister()| and just 
 hides some work) that will register your plugin in the framework thus granting 
 access to required features. Almost all features are defined in 
 plugin/frawor/*.vim files.
         loaded when it is registered. Arguments {g} and {F} must contain 
         dictionaries with global and function variables.
 
+frawor#Setup(version, dependencies, oneload)                  *frawor#Setup()*
+        Creates s:F, s:g global variables, s:Eval function and registers 
+        a plugin using |FraworRegister()|, saving its return value to 
+        s:g._frawor. Usage: >
+            execute frawor#Setup([0, 0], {"plugin/frawor": [0, 0]}, 0)
+<       You may replace [0, 0] here with "0.0", but remember that it is 
+        frawor#Setup extension, it won't work with FraworRegister.
+        Note: you must |:execute| frawor#Setup, not |:call| it.
+
 ------------------------------------------------------------------------------
 2.2. Commands                                                *frawor-commands*