Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated vital#of({plugin-name}) with vital#{plugin-name}#new() #435

Merged
merged 7 commits into from
Aug 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
- open()
- is_cmdwin()
Use Vim.Buffer's one instead.
aabb291268c0977e1444b0901e816db4467d6806
Modules: *
'vital#{plugin-name}#of()' was renamed to 'vital#{plugin-name}#new()'.
982d3cb87ef788f4607fc61f1fd20ec2e3975479
Modules: Vim.Guard
Guard.store() API has changed to take a single List instance instead of arguments, due to the
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Assuming your Vim plugin name is `ujihisa`. You can define your utility
function set `ujihisa#util` just by

```vim
let s:V = vital#of('ujihisa')
let s:V = vital#ujihisa#new()
function! ujihisa#util#system(...)
return call(s:V.system, a:000, s:V)
endfunction
Expand All @@ -117,7 +117,7 @@ Vital has module system. The below is an example to import/load a module

```vim
" Recommented way
let s:V = vital#of('ujihisa')
let s:V = vital#ujihisa#new()
let s:O = s:V.import('Data.OrderedSet')
call s:O.f()
```
Expand All @@ -126,7 +126,7 @@ or

```vim
" Recommended way only if you rarely use the module
let s:V = vital#of('ujihisa')
let s:V = vital#ujihisa#new()
call s:V.load('Data.OrderedSet')
call s:V.Data.OrderedSet.f()
```
Expand All @@ -135,7 +135,7 @@ or

```vim
" Available, but we don't recommend this very much
let s:V = vital#of('ujihisa')
let s:V = vital#ujihisa#new()
call s:V.import('Data.OrderedSet', s:)
call s:f()
```
Expand Down
2 changes: 1 addition & 1 deletion autoload/vital/_vital.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let s:_plugin_name = expand('<sfile>:t:r')

function! vital#{s:_plugin_name}#new() abort
return vital#{s:_plugin_name[1:]}#of()
return vital#{s:_plugin_name[1:]}#new()
endfunction
4 changes: 2 additions & 2 deletions autoload/vital/vital.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ else
endfunction
endif

function! vital#{s:plugin_name}#of() abort
function! vital#{s:plugin_name}#new() abort
return s:new(s:plugin_name)
endfunction

Expand Down Expand Up @@ -170,7 +170,7 @@ function! s:_import(name) abort dict
let s:loaded[a:name] = export_module
if has_key(module, '_vital_loaded')
try
call module._vital_loaded(vital#{s:plugin_name}#of())
call module._vital_loaded(vital#{s:plugin_name}#new())
catch
unlet s:loaded[a:name]
throw 'vital: fail to call ._vital_loaded(): ' . v:exception
Expand Down
2 changes: 1 addition & 1 deletion autoload/vitalizer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let s:LOADER_FILES = [
\ 'autoload/vital/vital.vim',
\ 'autoload/vital/_vital.vim',
\ ]
let s:V = vital#vital#of()
let s:V = vital#vital#new()
let s:P = s:V.import('Prelude')
let s:L = s:V.import('Data.List')
let s:S = s:V.import('Data.String')
Expand Down
8 changes: 4 additions & 4 deletions doc/vital-assertion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ define({assert_command_name}, ...) *Vital.Assertion.define()*

1) Succeeded
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')

call s:A.define('Assert', 1)
Expand All @@ -45,7 +45,7 @@ define({assert_command_name}, ...) *Vital.Assertion.define()*

2) Failed
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')

call s:A.define('Assert', 1)
Expand All @@ -66,7 +66,7 @@ define({assert_command_name}, ...) *Vital.Assertion.define()*

1) Succeeded
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')

call s:A.define('Assert', 1)
Expand All @@ -78,7 +78,7 @@ define({assert_command_name}, ...) *Vital.Assertion.define()*

2) Failed
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:A = s:V.import('Assertion')

call s:A.define('Assert', 1)
Expand Down
4 changes: 2 additions & 2 deletions doc/vital-concurrent_process.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Note that this usage gives you little benefit to you comparing just to use
system(), vimproc#system(), or Vital.Process.system(). Keep reading other
examples before you try to use this for your own plugin ;)
>
let s:CP = vital#of('vital').import('ConcurrentProcess')
let s:CP = vital#{plugin-name}#new().import('ConcurrentProcess')

function! s:list_files(path) abort
let label = s:CP.of(['ls', a:path], '', [
Expand Down Expand Up @@ -92,7 +92,7 @@ Things to learn from this example:

You can give text to stdin as well.
>
let s:CP = vital#of('vital').import('ConcurrentProcess')
let s:CP = vital#{plugin-name}#new().import('ConcurrentProcess')

function! s:with_linenum(text) abort
let label = s:CP.of('cat -n', '', [
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-bignum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ INTRODUCTION *Vital.Data.BigNum-introduction*
It provides some functions to manipulate multi precision integer.

>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:BigNum = s:V.import("Data.BigNum")

let x = s:BigNum.from_num(42)
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-closure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ INTRODUCTION *Vital.Data.Closure-introduction*

*Vital.Data.Closure* provides Closure object.
>
let C = vital#of('vital').import('Data.Closure')
let C = vital#{plugin-name}#new().import('Data.Closure')
<


Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-counter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ INTRODUCTION *Vital.Data.Counter-introduction*
*Vital.Data.Counter* is a counter library to support convenient tallies.

>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:Counter = s:V.import('Data.Counter')
let s:Math = s:V.import('Math')

Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-lazylist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ INTRODUCTION *Vital.Data.LazyList-introduction*
==============================================================================
USAGE *Vital.Data.LazyList-usage*
>
let s:L = vital#of('vital').import('Data.LazyList')
let s:L = vital#{plugin-name}#new().import('Data.LazyList')
let xs = s:L.file_readlines('/tmp/a.txt')
let xs = s:L.map(xs, 'split(v:val, ":")')
let xs = s:L.filter(xs, 'v:val[1] < 3')
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ INTRODUCTION *Vital.Data.List-introduction*
manipulate |List|.

>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:L = s:V.import("Data.List")

let s = []
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-set.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ It provides set and frozenset data structure ported from python.
https://docs.python.org/3.4/library/stdtypes.html#set-types-set-frozenset

>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:Set = s:V.import("Data.Set")

let set = s:Set.set([1,1,2,3,4,4,5])
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-string-interpolation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ INTRODUCTION *Vital.Data.String.Interpolation-introduction*

*Vital.Data.String.Interpolation* is String interpolation library.
>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:I = s:V.import("Data.String.Interpolation")
>
echo s:I.interpolate('Hi, ${name}!', {'name': 'haya14busa'})
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-string.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ INTRODUCTION *Vital.Data.String-introduction*
*Vital.Data.String* is String Utilities Library.
It provides some functions to manipulate |String|.
>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:S = s:V.import("Data.String")
<

Expand Down
2 changes: 1 addition & 1 deletion doc/vital-data-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Tree.renderer *Vital.Data.Tree.renderer*
EXAMPLES *Vital.Data.Tree-examples*

>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:T = s:V.import('Data.Tree')

let tree_obj = s:T.new('+',1,s:T.new('-',2,3))
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-locale-message.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INTRODUCTION *Vital.Locale.Message-introduction*
==============================================================================
USAGE *Vital.Locale.Message-usage*
>
let s:V = vital#of('my-plugin')
let s:V = vital#my_plugin#new()
let s:message = s:V.import('Locale.Message').new('my-plugin')
function! s:_(text)
return s:message._(a:text)
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-lua-prelude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ can write bridge function below:

sample.vim
>
let s:V = vital#of('sample')
let s:V = vital#sample#new()
let s:P = s:V.import('Lua.Prelude')
" s:LuaP is namespace of Vital.Lua.Prelude
let s:LuaP = s:P.lua_namespace()
Expand Down
4 changes: 2 additions & 2 deletions doc/vital-option_parser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ define a command with |Vital.OptionParser-Parser.parse()|.
This library's interface is inspired by OptionParser in Ruby.
>
" make option parser instance
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:O = s:V.import('OptionParser')
let s:parser = s:O.new()

Expand Down Expand Up @@ -280,7 +280,7 @@ Below is an output example.
<
If you don't want to use "--help", set OptionParser.disable_auto_help to 1.
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:O = s:V.import('OptionParser')
let s:parser = s:O.new()
let s:parser.disable_auto_help = 1
Expand Down
6 changes: 3 additions & 3 deletions doc/vital-prelude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ globpath({path}, {expr}) *Vital.Prelude.globpath()*
is_numeric({value}) *Vital.Prelude.is_numeric()*
Returns non-zero if {value} is a |Number| or a |Float|, zero otherwise.
Examples: >
:let s:V = vital#of('vital')
:let s:V = vital#{plugin-name}#new()
:let s:P = s:V.import('Prelude')
:echo s:P.is_numeric(123)
< 1 >
Expand All @@ -50,7 +50,7 @@ is_numeric({value}) *Vital.Prelude.is_numeric()*
is_number({value}) *Vital.Prelude.is_number()*
Returns non-zero if {value} is a |Number|, zero otherwise.
Examples: >
:let s:V = vital#of('vital')
:let s:V = vital#{plugin-name}#new()
:let s:P = s:V.import('Prelude')
:echo s:P.is_number(123)
< 1 >
Expand All @@ -62,7 +62,7 @@ is_number({value}) *Vital.Prelude.is_number()*
is_float({value}) *Vital.Prelude.is_float()*
Returns non-zero if {value} is a |Float|, zero otherwise.
Examples: >
:let s:V = vital#of('vital')
:let s:V = vital#{plugin-name}#new()
:let s:P = s:V.import('Prelude')
:echo s:P.is_float(123)
< 0 >
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-random-mt19937ar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This implementation always generates 32bit number [-2147483648, 2147483647],
even when you use Vim with |+num64|.

>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:M = s:V.import("Random.Mt19937ar")

call s:M.srand(1)
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-random-xor128.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This implementation always generates 32bit number [-2147483648, 2147483647],
even when you use Vim with |+num64|.

>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:X = s:V.import("Random.Xor128")

call s:X.srand(1)
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-random.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ INTRODUCTION *Vital.Random-introduction*

*Vital.Random-synopsis*
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:Random = s:V.import('Random')

" Generate a random number.
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-system-cache-dummy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ USAGE *Vital.System.Cache.Dummy-usage*
|Vital.Syste.Cache.Dummy| have all required API of unified cache system but
nothing would be cached. The following code works without caching values.
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:C = s:V.import('System.Cache.Dummy')

let s:factorial_cache = s:C.new()
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-system-cache-file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ store cache in a filesystem.
In the following example, |Vital.System.Cache.File| is used for memorize the
calculated values.
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:C = s:V.import('System.Cache.File')

let s:factorial_cache = s:C.new({'cache_dir': '.cache'})
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-system-cache-memory.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ values are stored in a |Dictionary| instance.
In the following example, |Vital.System.Cache.Memory| is used for memorize the
calculated values.
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:C = s:V.import('System.Cache.Memory')

let s:factorial_cache = s:C.new()
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-system-cache-singlefile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ values are stored in a |Dictionary| instance.
In the following example, |Vital.System.Cache.SingleFile| is used for memorize
the calculated values.
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:C = s:V.import('System.Cache.SingleFile')

let s:factorial_cache = s:C.new({'cache_file': '.cache'})
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-system-file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ INTRODUCTION *Vital.System.File-introduction*
It provides some functions for file system.

>
let s:V = vital#of("vital")
let s:V = vital#{plugin-name}#new()
let s:F = s:V.import("System.File")
<

Expand Down
2 changes: 1 addition & 1 deletion doc/vital-text-lexer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ EXAMPLES *Vital.Text.Lexer-examples*

lexer example *Vital.Text.Lexer-lexer-example*
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:L = s:V.import('Text.Lexer')
try
echo s:L.lexer([['digit','\d\+'],['whitespace','\s\+']]).exec('53 4')
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-text-parser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Parser.config({dict}) *Vital.Text.Parser-Parser.config()*
EXAMPLES *Vital.Text.Parser-examples*

>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:L = s:V.import('Text.Lexer')
let s:P = s:V.import('Text.Parser')

Expand Down
2 changes: 1 addition & 1 deletion doc/vital-text-table.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ table such as below:
|Vital.Text.Table| is easy to use. You can make a character table such above
by:
>
let s:T = vital#of('vital').import('Text.Table')
let s:T = vital#{plugin-name}#new().import('Text.Table')
let s:table = s:T.new({
\ 'columns': [{}, {}, {}],
\ 'header': ['header1', 'header2', 'header3'],
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-vim-python.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ INTRODUCTION *Vital.Vim.Python-introduction*
*Vital.Vim.Python* provides compatible functions of |python|, |pyfile|, and |pyeval|.
It automatically uses a correct function/command to execute a Python code/file.
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:P = s:V.import('Vim.Python')

" Check if Python is enabled
Expand Down
2 changes: 1 addition & 1 deletion doc/vital-vim-script_local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ INTRODUCTION *Vital.Vim.ScriptLocal-introduction*

*Vital.Vim.ScriptLocal* provides a way to get script local things.
>
let s:V = vital#of('vital')
let s:V = vital#{plugin-name}#new()
let s:S = s:V.import('Vim.ScriptLocal')
>
"" Get <SID> with relative path to &runtimepath
Expand Down
Loading