diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-08-01 14:45:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-01 14:45:57 +0800 |
commit | db928f0dd30ee403819a491ab993aaa55855f6a0 (patch) | |
tree | fc756ca92f2ce1c9f6bf1149b15edd5cf674ebed | |
parent | 2b4049719ab6cc01afcde3b5be7ba33fd1e33ab4 (diff) | |
download | rneovim-db928f0dd30ee403819a491ab993aaa55855f6a0.tar.gz rneovim-db928f0dd30ee403819a491ab993aaa55855f6a0.tar.bz2 rneovim-db928f0dd30ee403819a491ab993aaa55855f6a0.zip |
vim-patch:8.2.4275: cannot use an autoload function from a package under start (#29937)
Problem: Cannot use an autoload function from a package under start.
Solution: Also look in the "start" package directory. (Bjorn Linse,
closes vim/vim#7193)
https://github.com/vim/vim/commit/223a950a85448253780da4e821a5b23dcdfad28f
Nvim already does this in do_in_cached_path(), and this change has no
effect in Nvim as Nvim removes DIP_START after do_in_cached_path().
Accidentally failed to mark as ported:
vim-patch:8.2.1731: Vim9: cannot use += to append to empty NULL list
Co-authored-by: bfredl <bjorn.linse@gmail.com>
-rw-r--r-- | src/nvim/runtime.c | 2 | ||||
-rw-r--r-- | test/old/testdir/test_packadd.vim | 13 |
2 files changed, 14 insertions, 1 deletions
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/<name>.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' |