mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
"nvim -es": disable shada #21723
Problem: `nvim -es` (and `nvim -Es`) is the recommended way to non-interactively run commands/vimscript. But it enables shada by default, which is usually not wanted. Solution: - Disable shada by default for `nvim -es/-Es`. This can be overridden by `-i foo` if needed. - Do NOT change the 'loadplugins' default. - User config + packages _should_ be enabled by default, for both `nvim -es` and `nvim -l`. Else any Lua packages you have can't be accessed without `-u path/to/config`, which is clumsy. - Use-cases: ``` nvim --headless "+Lazy! sync" +qa would become: nvim -es "+Lazy! sync" nvim --headless +PlugInstall +qall would become: nvim -es +PlugInstall ``` - Opt-out (`--clean` or `-u NONE`) is much easier than opt-in (`-u path/to/config`). - User config/packages are analogous to pip packages, which are expected when doing `python -c ...`. related:7c94bcd2d7
related:ddd0eb6f51
This commit is contained in:
@@ -1228,6 +1228,9 @@ static void command_line_scan(mparm_T *parmp)
|
||||
if (exmode_active) { // "-es" silent (batch) Ex-mode
|
||||
silent_mode = true;
|
||||
parmp->no_swap_file = true;
|
||||
if (p_shadafile == NULL || *p_shadafile == NUL) {
|
||||
set_option_value_give_err(kOptShadafile, STATIC_CSTR_AS_OPTVAL("NONE"), 0);
|
||||
}
|
||||
} else { // "-s {scriptin}" read from script file
|
||||
want_argument = true;
|
||||
}
|
||||
@@ -2085,8 +2088,7 @@ static void source_startup_scripts(const mparm_T *const parmp)
|
||||
{
|
||||
// If -u given, use only the initializations from that file and nothing else.
|
||||
if (parmp->use_vimrc != NULL) {
|
||||
if (strequal(parmp->use_vimrc, "NONE")
|
||||
|| strequal(parmp->use_vimrc, "NORC")) {
|
||||
if (strequal(parmp->use_vimrc, "NONE") || strequal(parmp->use_vimrc, "NORC")) {
|
||||
// Do nothing.
|
||||
} else {
|
||||
if (do_source(parmp->use_vimrc, false, DOSO_NONE, NULL) != OK) {
|
||||
|
Reference in New Issue
Block a user