From 687eb0b39f3bcad9566198b4c60bbd2755032991 Mon Sep 17 00:00:00 2001 From: shadmansaleh Date: Mon, 31 May 2021 17:35:13 +0600 Subject: feat(startup): Source runtime/plugin/**/*.lua at startup For opt plugins these files are sourced on `:packadd` * `:runtime` Now can exexute lua files --- runtime/doc/repeat.txt | 8 ++++++-- runtime/doc/starting.txt | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index dd05084652..c7806398d8 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -187,8 +187,10 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. *:ru* *:runtime* :ru[ntime][!] [where] {file} .. - Read Ex commands from {file} in each directory given - by 'runtimepath' and/or 'packpath'. There is no error + Source vim/lua {file} in each directory given by + 'runtimepath' and/or 'packpath'. The vim files are + executed in same mannar as |:source| and lua files + similarly as |:luafile|. There is no error for non-existing files. Example: > @@ -244,6 +246,8 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. Note that {name} is the directory name, not the name of the .vim file. All the files matching the pattern pack/*/opt/{name}/plugin/**/*.vim ~ + and + pack/*/opt/{name}/plugin/**/*.lua ~ will be sourced. This allows for using subdirectories below "plugin", just like with plugins in 'runtimepath'. diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index ae9022c56c..3a3caea126 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -469,10 +469,15 @@ accordingly. Vim proceeds in this order: 7. Load the plugin scripts. *load-plugins* This does the same as the command: > :runtime! plugin/**/*.vim + :runtime! plugin/**/*.lua < The result is that all directories in the 'runtimepath' option will be searched for the "plugin" sub-directory and all files ending in ".vim" - will be sourced (in alphabetical order per directory), also in - subdirectories. + and ".lua" will be sourced (in alphabetical order per directory), + also in subdirectories. First all the "*.vim" files will be sourced and + then all the "*.lua" files will be sourced. If two files with same + name but different extensions exists they will be treated in same + manner. For example when both "foo.vim" and "foo.lua" exists then + first "foo.vim" will be sourced then "foo.lua" will be ran. However, directories in 'runtimepath' ending in "after" are skipped here and only loaded after packages, see below. Loading plugins won't be done when: -- cgit