refactor: move init_default_autocmds to lua

The original motivation for this change came from developping
https://github.com/neovim/neovim/pull/22159, which will require adding
more autocommand creation to Neovim's startup sequence.

This change requires lightly editing a test that expected no autocommand
to have been created from lua.
This commit is contained in:
glacambre
2023-02-11 09:45:11 +01:00
parent 5ca6cf55f9
commit c5b34fa554
4 changed files with 24 additions and 36 deletions

View File

@@ -404,19 +404,16 @@ int main(int argc, char **argv)
open_script_files(&params);
// Default mappings (incl. menus)
// Default mappings (incl. menus) & autocommands
Error err = ERROR_INIT;
Object o = NLUA_EXEC_STATIC("return vim._init_default_mappings()",
Object o = NLUA_EXEC_STATIC("return vim._init_defaults()",
(Array)ARRAY_DICT_INIT, &err);
assert(!ERROR_SET(&err));
api_clear_error(&err);
assert(o.type == kObjectTypeNil);
api_free_object(o);
TIME_MSG("init default mappings");
init_default_autocmds();
TIME_MSG("init default autocommands");
TIME_MSG("init default mappings & autocommands");
bool vimrc_none = strequal(params.use_vimrc, "NONE");