refactor(lua): initialize lua state at startup instead of dynamically

lua is used as part of implementation for more core features. As an
example, every user keypress will invoke a lua function to check for
keypress handlers (regardless if they are registered or not). Thus not
starting lua until it is first used doesn't make much sense anymore.

nlua_enter was also needed due to the earlier stateful &rtp
translation, which by now have been made stateless.
This commit is contained in:
Björn Linse
2021-07-18 19:05:56 +02:00
parent c36df20aef
commit e877eccafd
2 changed files with 22 additions and 44 deletions

View File

@@ -7,8 +7,6 @@
#include <string.h>
#include <stdbool.h>
#include <lua.h>
#include <lauxlib.h>
#include <msgpack.h>
#include "nvim/ascii.h"
@@ -258,6 +256,8 @@ int main(int argc, char **argv)
// Check if we have an interactive window.
check_and_set_isatty(&params);
nlua_init();
// Process the command line arguments. File names are put in the global
// argument list "global_alist".
command_line_scan(&params);
@@ -341,7 +341,6 @@ int main(int argc, char **argv)
TIME_MSG("initialized screen early for UI");
}
// open terminals when opening files that start with term://
#define PROTO "term://"
do_cmdline_cmd("augroup nvim_terminal");