Rescently I am in favor of a Vim plugin called Vundle. a dict named as g:bundle
has a item:
{'path': function('1')}
If I call the item.path(), Vundle can invoke "s:bundle.path()" in vundle/config.vim :
func! s:bundle.path()
return s:expand_path(g:bundle_dir.'/'.self.name)
endf
So, could you tell me the usage about parameter "1" of anonymous function in Vimscript?
Updated:
Thanks for Mr. Karkat.
I use :function {1}
command, whose result is:
function 1() dict
return s:expand_path(g:bundle_dir.'/'.self.name)
endfunction
the function block is same as s:bundle.path()
, it proves that number in braces means Funcref
:
The function will then get a nusmber and the value of dict.len is a Funcref that references this function. The function can only be used through a Funcref. It will automatically be deleted when there is no Funcref remaining that refers to it.
Referance:
https://github.com/gmarik/Vundle.vim/blob/master/autoload/vundle/config.vim#L106 http://vimdoc.sourceforge.net/htmldoc/eval.html#Dictionary-function