From 20e77c5d886af54d1f7b6844cffc11129f579ad9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 28 Aug 2025 23:43:10 -0400 Subject: build: ship "_core/*" as bytecode (built-into Nvim binary) Problem: We want to encourage implementing core features in Lua instead of C, but it's clumsy because: - Core Lua code (built into `nvim` so it is available even if VIMRUNTIME is missing/invalid) requires manually updating CMakeLists.txt, or stuffing it into `_editor.lua`. - Core Lua modules are not organized similar to C modules, `_editor.lua` is getting too big. Solution: - Introduce `_core/` where core Lua code can live. All Lua modules added there will automatically be included as bytecode in the `nvim` binary. - Move these core modules into `_core/*`: ``` _defaults.lua _editor.lua _options.lua _system.lua shared.lua ``` TODO: - Move `_extui/ => _core/ui2/` --- src/nvim/lua/executor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/lua/executor.c') diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 4073e0f9a8..181a549e23 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -2137,8 +2137,8 @@ void nlua_set_sctx(sctx_T *current) // Files where internal wrappers are defined so we can ignore them // like vim.o/opt etc are defined in _options.lua char *ignorelist[] = { - "vim/_editor.lua", - "vim/_options.lua", + "vim/_core/editor.lua", + "vim/_core/options.lua", "vim/keymap.lua", }; int ignorelist_size = sizeof(ignorelist) / sizeof(ignorelist[0]); @@ -2404,14 +2404,14 @@ plain: {} return arena_printf(arena, "", ref).data; } -/// Execute the vim._defaults module to set up default mappings and autocommands +/// Execute the vim._core.defaults module to set up default mappings and autocommands void nlua_init_defaults(void) { lua_State *const L = global_lstate; assert(L); lua_getglobal(L, "require"); - lua_pushstring(L, "vim._defaults"); + lua_pushstring(L, "vim._core.defaults"); if (nlua_pcall(L, 1, 0)) { fprintf(stderr, "%s\n", lua_tostring(L, -1)); } -- cgit