diff options
author | ZyX <kp-pav@yandex.ru> | 2017-05-23 00:46:57 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-05-25 16:27:40 +0300 |
commit | 97602371e6b00f280ede5e3f6b0e0c1144f46c72 (patch) | |
tree | 669833472c79750f8a590b766f0890b344a1f611 /runtime | |
parent | a5a5c83608e6d4455ac40e8786fd16eaf817c608 (diff) | |
download | rneovim-97602371e6b00f280ede5e3f6b0e0c1144f46c72.tar.gz rneovim-97602371e6b00f280ede5e3f6b0e0c1144f46c72.tar.bz2 rneovim-97602371e6b00f280ede5e3f6b0e0c1144f46c72.zip |
lua: Add paths from &runtimepath to package.path and package.cpath
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/if_lua.txt | 27 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 2 |
2 files changed, 28 insertions, 1 deletions
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 470f3bde7a..2e4d32027d 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -9,7 +9,32 @@ Lua Interface to Nvim *lua* *Lua* Type <M-]> to see the table of contents. ============================================================================== -1. Commands *lua-commands* +1. Importing modules *lua-require* + +Neovim lua interface automatically adjusts `package.path` and `package.cpath` +according to effective &runtimepath value. Adjustment happens after each time +'runtimepath' is changed, `package.path` and `package.cpath` are adjusted by +prepending directories from 'runtimepath' each suffixed by `/lua` and +`?`-containing suffixes from `package.path` and `package.cpath`. I.e. when +'runtimepath' option contains `/foo` and `package.path` contains only +`./a?d/j/g.nlua;./?.lua;/bar/?.lua` the resulting `package.path` after +adjustments will look like this: > + + /foo/lua/?.lua;/foo/lua/a?d/j/g.nlua;./a?d/j/g.nlua;./?.lua;/bar/?.lua + +Note that code have taken everything starting from the last path component +from existing paths containing a question mark as a `?`-containing suffix, but +only applied unique suffixes. + +Note 2: even though adjustments happens automatically Neovim does not track +current values of `package.path` or `package.cpath`. If you happened to delete +some paths from there you need to reset 'runtimepath' to make them readded. + +Note 3: paths from 'runtimepath' which contain semicolons cannot be put into +`package.[c]path` and thus are ignored. + +============================================================================== +2. Commands *lua-commands* *:lua* :[range]lua {chunk} diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 8851ef2d4b..24410ddaac 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -244,6 +244,8 @@ Lua interface (|if_lua.txt|): while calling lua chunk: [string "<VimL compiled string>"]:1: TEST” in Neovim. - Lua has direct access to Nvim |API| via `vim.api`. +- Lua package.path and package.cpath are automatically updated according to + 'runtimepath': |lua-require|. - Currently, most legacy Vim features are missing. |input()| and |inputdialog()| gained support for each other’s features (return |