diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-06-11 17:42:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-11 17:42:21 +0200 |
commit | 81a6b70880efa21dc45c6b222ca3c2d794c85b36 (patch) | |
tree | dbccb3560996a9ef3aac1ad176ada23dfe986cc2 /src/nvim/lua/executor.c | |
parent | fa768152dc5523ce7656a55253a626eea5180396 (diff) | |
parent | e1edc079dd0d0cb4a53e5998086568cf9d10a26a (diff) | |
download | rneovim-81a6b70880efa21dc45c6b222ca3c2d794c85b36.tar.gz rneovim-81a6b70880efa21dc45c6b222ca3c2d794c85b36.tar.bz2 rneovim-81a6b70880efa21dc45c6b222ca3c2d794c85b36.zip |
Merge pull request #14686 from shadmansaleh/feat/evaluate_plugin/lua
runtime: allow to use .lua files for most features defined as &rtp/{feature}/*.vim
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 0a52cc16cb..afc387ef38 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1161,6 +1161,24 @@ static void nlua_typval_exec(const char *lcmd, size_t lcmd_len, } } +int nlua_source_using_linegetter(LineGetter fgetline, + void *cookie, char *name) +{ + garray_T ga; + char_u *line = NULL; + + ga_init(&ga, (int)sizeof(char_u *), 10); + while ((line = fgetline(0, cookie, 0, false)) != NULL) { + GA_APPEND(char_u *, &ga, line); + } + char *code = (char *)ga_concat_strings_sep(&ga, "\n"); + size_t len = strlen(code); + nlua_typval_exec(code, len, name, NULL, 0, false, NULL); + ga_clear_strings(&ga); + xfree(code); + return OK; +} + /// Call a LuaCallable given some typvals /// /// Used to call any lua callable passed from Lua into VimL |