aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/globals.h1
-rw-r--r--src/nvim/main.c5
-rw-r--r--src/nvim/option_defs.h1
-rw-r--r--src/nvim/options.lua18
-rw-r--r--src/nvim/shada.c10
5 files changed, 28 insertions, 7 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index b529357dea..79af4a8ce3 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -754,7 +754,6 @@ EXTERN int skip_redraw INIT(= FALSE); /* skip redraw once */
EXTERN int do_redraw INIT(= FALSE); /* extra redraw once */
EXTERN int need_highlight_changed INIT(= true);
-EXTERN char *used_shada_file INIT(= NULL); // name of the ShaDa file to use
EXTERN FILE *scriptout INIT(= NULL); ///< Stream to write script to.
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 331cfc9f61..27e2abe1ad 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -871,6 +871,9 @@ static void command_line_scan(mparm_T *parmp)
} else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0) {
want_argument = true;
argv_idx += 11;
+ } else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0) {
+ parmp->use_vimrc = "NONE";
+ set_option_value("shadafile", 0L, "NONE", 0);
} else {
if (argv[0][argv_idx])
mainerr(err_opt_unknown, argv[0]);
@@ -1129,7 +1132,7 @@ static void command_line_scan(mparm_T *parmp)
}
case 'i': { // "-i {shada}" use for shada
- used_shada_file = argv[0];
+ set_option_value("shadafile", 0L, argv[0], 0);
break;
}
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 2075d2819c..3e116095fd 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -630,6 +630,7 @@ EXTERN long p_ur; ///< 'undoreload'
EXTERN long p_uc; ///< 'updatecount'
EXTERN long p_ut; ///< 'updatetime'
EXTERN char_u *p_shada; ///< 'shada'
+EXTERN char *p_shadafile; ///< 'shadafile'
EXTERN char_u *p_vdir; ///< 'viewdir'
EXTERN char_u *p_vop; ///< 'viewoptions'
EXTERN unsigned vop_flags; ///< uses SSOP_ flags
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index a855610cc9..affddd8084 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -2015,6 +2015,15 @@ return {
defaults={if_true={vi="", vim="!,'100,<50,s10,h"}}
},
{
+ full_name='shadafile', abbreviation='sdf',
+ type='string', list='onecomma', scope={'global'},
+ deny_duplicates=true,
+ vi_def=true,
+ secure=true,
+ varname='p_shadafile',
+ defaults={if_true={vi=""}}
+ },
+ {
full_name='shell', abbreviation='sh',
type='string', scope={'global'},
secure=true,
@@ -2633,6 +2642,15 @@ return {
defaults={if_true={vi="", vim="!,'100,<50,s10,h"}}
},
{
+ full_name='viminfofile', abbreviation='vif',
+ type='string', list='onecomma', scope={'global'},
+ deny_duplicates=true,
+ vi_def=true,
+ secure=true,
+ varname='p_shadafile',
+ defaults={if_true={vi=""}}
+ },
+ {
full_name='virtualedit', abbreviation='ve',
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 658cd1ba46..6bbf91e0f9 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -856,13 +856,13 @@ static int msgpack_sd_writer_write(void *data, const char *buf, size_t len)
return 0;
}
-/// Check whether writing to shada file was disabled with -i NONE
+/// Check whether writing to shada file was disabled ("-i NONE" or "--clean").
///
/// @return true if it was disabled, false otherwise.
static bool shada_disabled(void)
FUNC_ATTR_PURE
{
- return used_shada_file != NULL && STRCMP(used_shada_file, "NONE") == 0;
+ return strequal(p_shadafile, "NONE");
}
/// Read ShaDa file
@@ -1542,14 +1542,14 @@ static char *shada_filename(const char *file)
FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT
{
if (file == NULL || *file == NUL) {
- if (used_shada_file != NULL) {
- file = used_shada_file;
+ if (p_shadafile != NULL) {
+ file = p_shadafile;
} else {
if ((file = find_shada_parameter('n')) == NULL || *file == NUL) {
file = shada_get_default_file();
}
// XXX It used to be one level lower, so that whatever is in
- // `used_shada_file` was expanded. I intentionally moved it here
+ // `p_shadafile` was expanded. I intentionally moved it here
// because various expansions must have already be done by the shell.
// If shell is not performing them then they should be done in main.c
// where arguments are parsed, *not here*.