aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 7d7eba2105..252aa81825 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -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);
@@ -318,7 +318,8 @@ int main(int argc, char **argv)
debug_break_level = params.use_debug_break_level;
// Read ex-commands if invoked with "-es".
- if (!params.input_isatty && silent_mode && exmode_active == EXMODE_NORMAL) {
+ if (!params.input_isatty && !params.input_neverscript
+ && silent_mode && exmode_active) {
input_start(STDIN_FILENO);
}
@@ -341,7 +342,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");
@@ -765,7 +765,7 @@ static bool edit_stdin(bool explicit, mparm_T *parmp)
{
bool implicit = !headless_mode
&& !embedded_mode
- && exmode_active != EXMODE_NORMAL // -E/-Es but not -e/-es.
+ && (!exmode_active || parmp->input_neverscript)
&& !parmp->input_isatty
&& scriptin[0] == NULL; // `-s -` was not given.
return explicit || implicit;
@@ -908,11 +908,12 @@ static void command_line_scan(mparm_T *parmp)
break;
}
case 'e': { // "-e" Ex mode
- exmode_active = EXMODE_NORMAL;
+ exmode_active = true;
break;
}
case 'E': { // "-E" Ex mode
- exmode_active = EXMODE_VIM;
+ exmode_active = true;
+ parmp->input_neverscript = true;
break;
}
case 'f': { // "-f" GUI: run in foreground.
@@ -1424,7 +1425,7 @@ static void handle_quickfix(mparm_T *paramp)
static void handle_tag(char_u *tagname)
{
if (tagname != NULL) {
- swap_exists_did_quit = FALSE;
+ swap_exists_did_quit = false;
vim_snprintf((char *)IObuff, IOSIZE, "ta %s", tagname);
do_cmdline_cmd((char *)IObuff);
@@ -1442,13 +1443,11 @@ static void read_stdin(void)
// When getting the ATTENTION prompt here, use a dialog.
swap_exists_action = SEA_DIALOG;
no_wait_return = true;
- int save_msg_didany = msg_didany;
+ bool save_msg_didany = msg_didany;
set_buflisted(true);
-
// Create memfile and read from stdin.
(void)open_buffer(true, NULL, 0);
-
- if (BUFEMPTY() && curbuf->b_next != NULL) {
+ if (buf_is_empty(curbuf) && curbuf->b_next != NULL) {
// stdin was empty, go to buffer 2 (e.g. "echo file1 | xargs nvim"). #8561
do_cmdline_cmd("silent! bnext");
// Delete the empty stdin buffer.
@@ -1634,7 +1633,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
curwin->w_arg_idx = arg_idx;
/* Edit file from arg list, if there is one. When "Quit" selected
* at the ATTENTION prompt close the window. */
- swap_exists_did_quit = FALSE;
+ swap_exists_did_quit = false;
(void)do_ecmd(0, arg_idx < GARGCOUNT
? alist_name(&GARGLIST[arg_idx]) : NULL,
NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
@@ -1816,7 +1815,8 @@ static bool do_user_initialization(void)
char_u *vimrc_path = (char_u *)stdpaths_user_conf_subpath("init.vim");
if (os_path_exists(vimrc_path)) {
- EMSG3(_("Conflicting configs: \"%s\" \"%s\""), init_lua_path, vimrc_path);
+ EMSG3(_("E5422: Conflicting configs: \"%s\" \"%s\""), init_lua_path,
+ vimrc_path);
}
xfree(vimrc_path);
@@ -2000,10 +2000,10 @@ static void mainerr(const char *errstr, const char *str)
/// Prints version information for "nvim -v" or "nvim --version".
static void version(void)
{
- info_message = TRUE; // use mch_msg(), not mch_errmsg()
+ info_message = true; // use mch_msg(), not mch_errmsg()
list_version();
msg_putchar('\n');
- msg_didout = FALSE;
+ msg_didout = false;
}
/// Prints help message for "nvim -h" or "nvim --help".