diff options
author | dm1try <me@dmitry.it> | 2020-05-03 23:49:11 +0300 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2020-12-01 10:51:25 +0100 |
commit | 767cd8b17b71f78bdd4c2e0dd8d3f4f0f1551381 (patch) | |
tree | 9d6d1ac306c0727e5f37c0c0cb58d665a8cf4c82 /src/nvim/lua/executor.c | |
parent | 13b88573005d84cc0ebcd7e7bf4dd488673919d3 (diff) | |
download | rneovim-767cd8b17b71f78bdd4c2e0dd8d3f4f0f1551381.tar.gz rneovim-767cd8b17b71f78bdd4c2e0dd8d3f4f0f1551381.tar.bz2 rneovim-767cd8b17b71f78bdd4c2e0dd8d3f4f0f1551381.zip |
startup: add init.lua as an alternative user config, fixes #7895
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 0a3c30134b..97f6d5bd31 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1244,6 +1244,23 @@ void ex_luafile(exarg_T *const eap) } } +bool load_init_lua(const char *script_path) +{ + lua_State *const lstate = nlua_enter(); + + if (luaL_loadfile(lstate, script_path)) { + nlua_error(lstate, _("E5112: Error while creating lua chunk: %.*s")); + return false; + } + + if (lua_pcall(lstate, 0, 0, 0)) { + nlua_error(lstate, _("E5113: Error while calling lua chunk: %.*s")); + return false; + } + + return true; +} + static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL { tslua_init(lstate); |