From 396280d3030685c6b7c4d962f24bb5171a735b47 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 11 Sep 2021 16:20:59 +0200 Subject: refactor(runtime): always use DIP_START when searching for runtime files Now remove the addition of "start/*" packages in 'packpath' as explicit items in 'runtimepath'. This avoids 'runtimepath' from becoming very long when using a lot of plugins as packages. To get the effective search path as a list, use |nvim_list_runtime_paths()| --- runtime/autoload/remote/host.vim | 2 +- runtime/doc/options.txt | 10 ++++++---- runtime/doc/repeat.txt | 30 ++++++++++++++++++++---------- 3 files changed, 27 insertions(+), 15 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index c34ff4bee7..884b478f19 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -114,7 +114,7 @@ function! s:RegistrationCommands(host) abort let host_id = a:host.'-registration-clone' call remote#host#RegisterClone(host_id, a:host) let pattern = s:plugin_patterns[a:host] - let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 1, 1) + let paths = nvim_get_runtime_file('rplugin/'.a:host.'/'.pattern, 1) let paths = map(paths, 'tr(resolve(v:val),"\\","/")') " Normalize slashes #4795 let paths = uniq(sort(paths)) if empty(paths) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index cc7524988d..bc4cdcbd80 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4328,7 +4328,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'packpath'* *'pp'* 'packpath' 'pp' string (default: see 'runtimepath') - Directories used to find packages. See |packages|. + Directories used to find packages. See |packages| and |rtp-packages|. *'paragraphs'* *'para'* @@ -4887,9 +4887,11 @@ A jump table for the options with a short description can be found at |Q_op|. ordering. This is for preferences to overrule or add to the distributed defaults or system-wide settings (rarely needed). - More entries are added when using |packages|. If it gets very long - then `:set rtp` will be truncated, use `:echo &rtp` to see the full - string. + *rtp-packages* + "start" packages will additionally be used to search for runtime files + after these, but package entries are not visible in `:set rtp`. + See |runtime-search-path| for more information. "opt" packages + will be explicitly added to &rtp when |:packadd| is used. Note that, unlike 'path', no wildcards like "**" are allowed. Normal wildcards are allowed, but can significantly slow down searching for diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 5fdd5fc3c0..7e8d93aa71 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -516,16 +516,26 @@ You would now have these files under ~/.local/share/nvim/site: pack/foo/start/foobar/syntax/some.vim pack/foo/opt/foodebug/plugin/debugger.vim -When Vim starts up, after processing your .vimrc, it scans all directories in -'packpath' for plugins under the "pack/*/start" directory. First all those -directories are added to 'runtimepath'. Then all the plugins are loaded. -See |packload-two-steps| for how these two steps can be useful. + *runtime-search-path* +When runtime files are searched for, first all paths in 'runtimepath' are +searched, then all "pack/*/start/*" dirs are searched. However, package entries +are not visible in `:set rtp` or `echo &rtp`, as the final concatenated path +would be too long and get truncated. To list all used directories, use +|nvim_list_runtime_paths()|. In addition |nvim_get_runtime_file()| can be used +to query for specific files or sub-folders within the runtime path. For +instance to list all runtime dirs and packages with lua paths, use > -In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and adds -"~/.local/share/nvim/site/pack/foo/start/foobar" to 'runtimepath'. + :echo nvim_get_runtime_file("lua/", v:true) + + +To load packages earlier, so that plugin/ files are sourced: :packloadall This also works when loading plugins is disabled. The automatic loading will only happen once. @@ -664,8 +674,8 @@ found automatically. Your package would have these files: < pack/foo/start/lib/autoload/foolib.vim > func foolib#getit() -This works, because loading packages will first add all found directories to -'runtimepath' before sourcing the plugins. +This works, because start packages will be used to look for autoload files, +when sourcing the plugins. ============================================================================== Debugging scripts *debug-scripts* -- cgit