diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2022-01-04 07:28:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 07:28:29 -0700 |
commit | 3fd454bd4a6ceb1989d15cf2d3d5e11d7a253b2d (patch) | |
tree | 1718a362cf49adabd478fe16a6e35335681d8611 /src/nvim/lua/executor.c | |
parent | cc62f3d6cb639abffb1b0b6ce47a481bc67003d2 (diff) | |
download | rneovim-3fd454bd4a6ceb1989d15cf2d3d5e11d7a253b2d.tar.gz rneovim-3fd454bd4a6ceb1989d15cf2d3d5e11d7a253b2d.tar.bz2 rneovim-3fd454bd4a6ceb1989d15cf2d3d5e11d7a253b2d.zip |
feat: filetype.lua (#16600)
Adds a new vim.filetype module that provides support for filetype detection in
Lua.
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 334fb91576..c814974fe7 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -434,6 +434,15 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL // [package, loaded, module] lua_setfield(lstate, -2, "vim.F"); // [package, loaded] + code = (char *)&lua_filetype_module[0]; + if (luaL_loadbuffer(lstate, code, sizeof(lua_filetype_module) - 1, "@vim/filetype.lua") + || nlua_pcall(lstate, 0, 1)) { + nlua_error(lstate, _("E5106: Error while creating vim.filetype module: %.*s")); + return 1; + } + // [package, loaded, module] + lua_setfield(lstate, -2, "vim.filetype"); // [package, loaded] + lua_pop(lstate, 2); // [] } |