diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index c479418131..2cae79c0fd 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -2857,7 +2857,7 @@ bool script_autoload(const char *const name, const size_t name_len, const bool r // Try loading the package from $VIMRUNTIME/autoload/.vim // Use "ret_sid" to avoid loading the same script again. int ret_sid; - if (do_in_runtimepath(scriptname, 0, source_callback, &ret_sid) == OK) { + if (do_in_runtimepath(scriptname, DIP_START, source_callback, &ret_sid) == OK) { ret = true; } } diff --git a/test/old/testdir/test_packadd.vim b/test/old/testdir/test_packadd.vim index 730cb3278b..47cf520bb9 100644 --- a/test/old/testdir/test_packadd.vim +++ b/test/old/testdir/test_packadd.vim @@ -258,6 +258,19 @@ func Test_packloadall() call assert_equal(4321, g:plugin_bar_number) endfunc +func Test_start_autoload() + " plugin foo with an autoload directory + let autodir = &packpath .. '/pack/mine/start/foo/autoload' + call mkdir(autodir, 'p') + let fname = autodir .. '/foobar.vim' + call writefile(['func foobar#test()', + \ ' return 1666', + \ 'endfunc'], fname) + + call assert_equal(1666, foobar#test()) + call delete(fname) +endfunc + func Test_helptags() let docdir1 = &packpath . '/pack/mine/start/foo/doc' let docdir2 = &packpath . '/pack/mine/start/bar/doc'