> Bram
> This works as intended.  Autoload scripts are only loaded when used.
> Not when you check if something defined in it exists.

This is expected behavior?
hmm, but checking this at command-line, exists() returns 1.
    :echo exists('*mylib#func')
and seeing :scriptnames, autoload/mylib.vim has been loaded.

This is also the same at "top level" of script.

------------------------
let s:is_exists = exists('*mylib#func')

function! s:foo()
    if s:is_exists
        call mylib#func()
    endif
endfunction

call s:foo()
------------------------

s:is_exists is 1 at this time, but
------------------------
function! s:foo()
    if exists('*mylib#func')
        call mylib#func()
    endif
endfunction

call s:foo()
------------------------
This does not call mylib#func() expectedly.


> Peter
Thanks.
I often add "mylib#load()" function to autoload script :-)

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui