aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-07-13 17:20:22 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-08-10 16:48:35 -0400
commite797d0658c70c734485f54e070cc7300dc47db57 (patch)
treec6f8df9a723cc7514d4c45f4b1bc7b833303925c /src
parent602e7505e2cd47ce0f45236a5175709d8ce2c489 (diff)
downloadrneovim-e797d0658c70c734485f54e070cc7300dc47db57.tar.gz
rneovim-e797d0658c70c734485f54e070cc7300dc47db57.tar.bz2
rneovim-e797d0658c70c734485f54e070cc7300dc47db57.zip
fix: runtimepath always updates lua package.path
Diffstat (limited to 'src')
-rw-r--r--src/nvim/lua/executor.c8
-rw-r--r--src/nvim/option.c5
2 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 0d5622f1e7..86da517685 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -543,6 +543,14 @@ static lua_State *nlua_enter(void)
return lstate;
}
+/// Force an update of lua's package paths if runtime path has changed.
+bool nlua_update_package_path(void)
+{
+ lua_State *const lstate = nlua_enter();
+
+ return !!lstate;
+}
+
static void nlua_print_event(void **argv)
{
char *str = argv[0];
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 2862419177..168160834b 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -80,6 +80,7 @@
#ifdef WIN32
# include "nvim/os/pty_conpty_win.h"
#endif
+#include "nvim/lua/executor.h"
#include "nvim/api/private/helpers.h"
#include "nvim/os/input.h"
#include "nvim/os/lang.h"
@@ -3344,6 +3345,10 @@ ambw_end:
if (!parse_winhl_opt(curwin)) {
errmsg = e_invarg;
}
+ } else if (varp == &p_rtp) { // 'runtimepath'
+ if (!nlua_update_package_path()) {
+ errmsg = (char_u *)N_("E970: Failed to initialize lua interpreter");
+ }
} else {
// Options that are a list of flags.
p = NULL;