vim - Calling autoloaded dictionary functions from other autoloaded dictionary functions in VimL (vimscript) -
is possible invoke autoloaded dictionary function within autoloaded dictionary function in vim script?
i want have in autoload/foo.vim:
function! foo#initialize() return 1 endfunction let foo#mydict = {} function! foo#mydict.say_hi() dict echo "hi" endfunction let foo#otherdict = {} function! foo#otherdict.call_hi() dict call foo#mydict.say_hi() endfunction and want use file/interactively/whatever:
call foo#initialize() call foo#otherdict.call_hi() unfortunately, gets me error:
e121: undefined variable: foo#mydict the call foo#initialize() necessary due bug/limitation in vim related dictionary functions not triggering autoload. there's google groups thread bram confirmed problem.
i'm not sure that's root of problem, however, because once file autoloaded (via foo#initialize()), invoking dictionary functions works in general. it's nested call example above that's giving me error.
to clarify, works fine:
function! foo#sayhello() echo "hello" endfunction function! foo#otherdict.say_hello() dict call foo#sayhello() end it's nested calls autoloaded dictionary functions fail.
the same happens when script put in plugin/ directory or explicitly :runtime'd before use. there's no error when instead of foo#mydict script-local s:mydict used. unexpected me, too. please submit bug on vim_dev mailing list.
Comments
Post a Comment