refactor: move defaults into separate module (#25929)

Move default mappings and autocommands into a separate module and add
comments and docstrings to document each of the defaults.
This commit is contained in:
Gregory Anders
2023-11-08 09:33:37 -06:00
committed by GitHub
parent 1b0fd377ab
commit 08847a9ea1
5 changed files with 184 additions and 158 deletions

View File

@@ -2291,3 +2291,17 @@ plain:
kv_printf(str, "<Lua %d>", ref);
return str.items;
}
/// Execute the vim._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");
if (nlua_pcall(L, 1, 0)) {
os_errmsg(lua_tostring(L, -1));
os_errmsg("\n");
}
}