diff options
author | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:03:25 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:03:25 +0200 |
commit | e573b3020c032400eed60b649a2cbf55266e6bb0 (patch) | |
tree | 8f572394ac8433529c7a8e70d160a2fbe8268b4e /vim/bundle/vim-addon-mw-utils/doc/funcref.txt | |
parent | b8c667bd64b3edd38d56c63c5bd1db53a23b4499 (diff) | |
download | myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.gz myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.bz2 myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.zip |
Add current configurations from old repository
Diffstat (limited to 'vim/bundle/vim-addon-mw-utils/doc/funcref.txt')
-rw-r--r-- | vim/bundle/vim-addon-mw-utils/doc/funcref.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vim/bundle/vim-addon-mw-utils/doc/funcref.txt b/vim/bundle/vim-addon-mw-utils/doc/funcref.txt new file mode 100644 index 0000000..cb366d0 --- /dev/null +++ b/vim/bundle/vim-addon-mw-utils/doc/funcref.txt @@ -0,0 +1,35 @@ +*funcref* create lazier function references. Pass arguments to create closure + like function calls + Author: Marc Weber, marco-oweber@gmx.de + +----------------------------------------------------------------------- +HOWTO~ + +Use *funcref#Function* to create a special dict called +*faked-function-reference* which can be called by *funcref#Call* +> + { 'faked_function_reference': 'file#FuncName' } +< passing some arguments and / or self: > + { 'faked_function_reference': 'MyFunc', 'args': [1,2], 'self' : { a object ] } +< You can also create lambda like functions which will be evaled: > + { 'faked_function_reference': 'return ARGS[1]' } + +REASONS ~ + Creating a Vim funcref pointing to an autoload function will make Vim source + that file. This is not lazy enough. (Seems to be no longer true? Has this changed?) + + A Vim function reference neither allows attaching arguments nor self. + + Don't care about case of variables. Normally when using Vim function + references you have to use variable names starting with an upper case letter + (E704) + +Example: ~ +> + let f = funcref#Function('return ARGS[0].ARGS[1].SELF["key"]',{'args':[3], 'self':{'key': 'value'} }) + echo funcref#Call(f, [2]) + " prints "32value" + + echo funcref#Call('no value') +< + echo funcref#Call(f, [2]) |