diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-09-11 16:20:59 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-09-18 13:53:50 +0200 |
commit | 396280d3030685c6b7c4d962f24bb5171a735b47 (patch) | |
tree | 08b04faa0d1fd328f0e89e8541b444c229633cd9 /runtime | |
parent | 8ef2b56cac895c151345cf0ff0a97456c0a7fdd2 (diff) | |
download | rneovim-396280d3030685c6b7c4d962f24bb5171a735b47.tar.gz rneovim-396280d3030685c6b7c4d962f24bb5171a735b47.tar.bz2 rneovim-396280d3030685c6b7c4d962f24bb5171a735b47.zip |
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()|
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/remote/host.vim | 2 | ||||
-rw-r--r-- | runtime/doc/options.txt | 10 | ||||
-rw-r--r-- | runtime/doc/repeat.txt | 30 |
3 files changed, 27 insertions, 15 deletions
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) + +<When Vim starts up, after processing your .vimrc, it scans all directories in +'packpath' for plugins under the "pack/*/start" directory, and all the plugins +are loaded. + +In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and load it. If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will -find the syntax/some.vim file, because its directory is in 'runtimepath'. +find the syntax/some.vim file, because its directory is in the runtime search +path. Vim will also load ftdetect files, if there are any. @@ -536,7 +546,7 @@ is used. Loading packages automatically will not happen if loading plugins is disabled, see |load-plugins|. -To load packages earlier, so that 'runtimepath' gets updated: > +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* |