Replace references to viminfo in various places
This commit is contained in:
parent
749cae8662
commit
9cf9c4a586
14
man/nvim.1
14
man/nvim.1
|
@ -138,7 +138,7 @@ Sets the options 'hkmap' and 'rightleft'.
|
|||
.It Fl V Ns Oo Ar N Oc Ns Op Ar file
|
||||
Verbose mode.
|
||||
Print messages about which files are being sourced and for reading and
|
||||
writing an nviminfo file.
|
||||
writing a ShaDa file.
|
||||
.Ar N
|
||||
is the value for the 'verbose' option; defaults to
|
||||
.Cm 10
|
||||
|
@ -191,18 +191,18 @@ is
|
|||
loading plugins is also skipped.
|
||||
See
|
||||
.Ic :help initialization .
|
||||
.It Fl i Ar nviminfo
|
||||
.It Fl i Ar shada
|
||||
Use
|
||||
.Ar nviminfo
|
||||
.Ar shada
|
||||
instead of the default of
|
||||
.Pa ~/.nviminfo .
|
||||
.Pa ~/.nvim/shada/main.shada .
|
||||
If
|
||||
.Ar nviminfo
|
||||
.Ar shada
|
||||
is
|
||||
.Cm NONE ,
|
||||
do not read or write an nviminfo file.
|
||||
do not read or write a ShaDa file.
|
||||
See
|
||||
.Ic :help viminfo .
|
||||
.Ic :help shada .
|
||||
.It Fl -noplugin
|
||||
Skip loading plugins.
|
||||
Implied by
|
||||
|
|
|
@ -1075,7 +1075,7 @@ if you stop editing a file without writing, like with ":n!".
|
|||
When you split a window, the jumplist will be copied to the new window.
|
||||
|
||||
If you have included the ' item in the 'viminfo' option the jumplist will be
|
||||
stored in the shada file and restored when starting Vim.
|
||||
stored in the ShaDa file and restored when starting Vim.
|
||||
|
||||
|
||||
CHANGE LIST JUMPS *changelist* *change-list-jumps* *E664*
|
||||
|
|
|
@ -476,7 +476,7 @@ accordingly. Vim proceeds in this order:
|
|||
|gui-init|.
|
||||
|
||||
9. Read the ShaDa file
|
||||
If the 'viminfo' option is not empty, the viminfo file is read. See
|
||||
If the 'viminfo' option is not empty, the ShaDa file is read. See
|
||||
|shada-file|.
|
||||
|
||||
10. Read the quickfix file
|
||||
|
@ -564,8 +564,8 @@ just like executing a command from a vimrc/exrc in the current directory.
|
|||
If Vim takes a long time to start up, use the |--startuptime| argument to find
|
||||
out what happens.
|
||||
|
||||
If you have "viminfo" enabled, the loading of the ShaDa file may take a
|
||||
while. You can find out if this is the problem by disabling viminfo for a
|
||||
If you have 'viminfo' enabled, the loading of the ShaDa file may take a
|
||||
while. You can find out if this is the problem by disabling ShaDa for a
|
||||
moment (use the Vim argument "-i NONE", |-i|). Try reducing the number of
|
||||
lines stored in a register with ":set viminfo='20,<50,s10". |shada-file|.
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ exiting Vim, there is a slightly more complicated way. You can see a list of
|
|||
files by typing the command: >
|
||||
|
||||
:oldfiles
|
||||
< 1: ~/.viminfo ~
|
||||
< 1: ~/.vimrc ~
|
||||
2: ~/text/resume.txt ~
|
||||
3: /tmp/draft ~
|
||||
|
||||
|
@ -188,7 +188,7 @@ That #<123 thing is a bit complicated when you just want to edit a file.
|
|||
Fortunately there is a simpler way: >
|
||||
|
||||
:browse oldfiles
|
||||
< 1: ~/.viminfo ~
|
||||
< 1: ~/.vimrc ~
|
||||
2: ~/text/resume.txt ~
|
||||
3: /tmp/draft ~
|
||||
-- More --
|
||||
|
|
|
@ -1226,8 +1226,8 @@ if has("mksession")
|
|||
call append("$", "viewdir\tdirectory where to store files with :mkview")
|
||||
call <SID>OptionG("vdir", &vdir)
|
||||
endif
|
||||
if has("viminfo")
|
||||
call append("$", "viminfo\tlist that specifies what to write in the viminfo file")
|
||||
if has("shada")
|
||||
call append("$", "viminfo\tlist that specifies what to write in the ShaDa file")
|
||||
call <SID>OptionG("vi", &vi)
|
||||
endif
|
||||
if has("quickfix")
|
||||
|
|
|
@ -9144,18 +9144,18 @@ int put_line(FILE *fd, char *s)
|
|||
*/
|
||||
static void ex_viminfo(exarg_T *eap)
|
||||
{
|
||||
char_u *save_viminfo;
|
||||
char_u *save_shada;
|
||||
|
||||
save_viminfo = p_viminfo;
|
||||
if (*p_viminfo == NUL)
|
||||
p_viminfo = (char_u *)"'100";
|
||||
save_shada = p_shada;
|
||||
if (*p_shada == NUL)
|
||||
p_shada = (char_u *)"'100";
|
||||
if (eap->cmdidx == CMD_rviminfo) {
|
||||
if (shada_read_everything((char *) eap->arg, eap->forceit) == FAIL)
|
||||
EMSG(_("E195: Cannot open ShaDa file for reading"));
|
||||
} else {
|
||||
shada_write_file((char *) eap->arg, eap->forceit);
|
||||
}
|
||||
p_viminfo = save_viminfo;
|
||||
p_shada = save_shada;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -2172,7 +2172,7 @@ readfile_charconvert (
|
|||
*/
|
||||
static void check_marks_read(void)
|
||||
{
|
||||
if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
|
||||
if (!curbuf->b_marks_read && get_shada_parameter('\'') > 0
|
||||
&& curbuf->b_ffname != NULL) {
|
||||
shada_read_marks();
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ int main(int argc, char **argv)
|
|||
* Read in registers, history etc, from the ShaDa file.
|
||||
* This is where v:oldfiles gets filled.
|
||||
*/
|
||||
if (*p_viminfo != NUL) {
|
||||
if (*p_shada != NUL) {
|
||||
(void) shada_read_file(NULL, (kShaDaWantInfo
|
||||
| kShaDaGetOldfiles
|
||||
| kShaDaWantMarks));
|
||||
|
@ -807,8 +807,8 @@ void getout(int exitval)
|
|||
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
|
||||
}
|
||||
|
||||
if (p_viminfo && *p_viminfo != NUL) {
|
||||
// Write out the registers, history, marks etc, to the viminfo file
|
||||
if (p_shada && *p_shada != NUL) {
|
||||
// Write out the registers, history, marks etc, to the ShaDa file
|
||||
shada_write_file(NULL, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -5238,7 +5238,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
|
|||
reg->additional_data = NULL;
|
||||
reg->timestamp = 0;
|
||||
// Timestamp is not saved for clipboard registers because clipboard registers
|
||||
// are not saved in the viminfo.
|
||||
// are not saved in the ShaDa file.
|
||||
|
||||
int i = 0;
|
||||
for (listitem_T *li = lines->lv_first; li != NULL; li = li->li_next) {
|
||||
|
|
|
@ -1743,11 +1743,11 @@ set_options_bin (
|
|||
* If the parameter is not specified in the string or there is no following
|
||||
* number, return -1.
|
||||
*/
|
||||
int get_viminfo_parameter(int type)
|
||||
int get_shada_parameter(int type)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
p = find_viminfo_parameter(type);
|
||||
p = find_shada_parameter(type);
|
||||
if (p != NULL && ascii_isdigit(*p))
|
||||
return atoi((char *)p);
|
||||
return -1;
|
||||
|
@ -1758,11 +1758,11 @@ int get_viminfo_parameter(int type)
|
|||
* '/') in the 'viminfo' option and return a pointer to the string after it.
|
||||
* Return NULL if the parameter is not specified in the string.
|
||||
*/
|
||||
char_u *find_viminfo_parameter(int type)
|
||||
char_u *find_shada_parameter(int type)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
for (p = p_viminfo; *p; ++p) {
|
||||
for (p = p_shada; *p; ++p) {
|
||||
if (*p == type)
|
||||
return p + 1;
|
||||
if (*p == 'n') /* 'n' is always the last one */
|
||||
|
@ -2443,8 +2443,8 @@ did_set_string_option (
|
|||
errmsg = e_invarg;
|
||||
}
|
||||
/* 'viminfo' */
|
||||
else if (varp == &p_viminfo) {
|
||||
for (s = p_viminfo; *s; ) {
|
||||
else if (varp == &p_shada) {
|
||||
for (s = p_shada; *s; ) {
|
||||
/* Check it's a valid character */
|
||||
if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) {
|
||||
errmsg = illegal_char(errbuf, *s);
|
||||
|
@ -2486,7 +2486,7 @@ did_set_string_option (
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0)
|
||||
if (*p_shada && errmsg == NULL && get_shada_parameter('\'') < 0)
|
||||
errmsg = (char_u *)N_("E528: Must specify a ' value");
|
||||
}
|
||||
/* 'showbreak' */
|
||||
|
|
|
@ -558,7 +558,7 @@ EXTERN long p_ur; /* 'undoreload' */
|
|||
EXTERN long p_uc; /* 'updatecount' */
|
||||
EXTERN long p_ut; /* 'updatetime' */
|
||||
EXTERN char_u *p_fcs; /* 'fillchar' */
|
||||
EXTERN char_u *p_viminfo; /* 'viminfo' */
|
||||
EXTERN char_u *p_shada; /* 'viminfo' */
|
||||
EXTERN char_u *p_vdir; /* 'viewdir' */
|
||||
EXTERN char_u *p_vop; /* 'viewoptions' */
|
||||
EXTERN unsigned vop_flags; /* uses SSOP_ flags */
|
||||
|
|
|
@ -2584,7 +2584,7 @@ return {
|
|||
type='string', list='comma', scope={'global'},
|
||||
deny_duplicates=true,
|
||||
secure=true,
|
||||
varname='p_viminfo',
|
||||
varname='p_shada',
|
||||
defaults={if_true={vi="", vim="!,'100,<50,s10,h"}}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -63,8 +63,8 @@ KHASH_MAP_INIT_STR(fnamebufs, buf_T *)
|
|||
|
||||
#define copy_option_part(src, dest, ...) \
|
||||
((char *) copy_option_part((char_u **) src, (char_u *) dest, __VA_ARGS__))
|
||||
#define find_viminfo_parameter(...) \
|
||||
((const char *) find_viminfo_parameter(__VA_ARGS__))
|
||||
#define find_shada_parameter(...) \
|
||||
((const char *) find_shada_parameter(__VA_ARGS__))
|
||||
#define emsg2(a, b) emsg2((char_u *) a, (char_u *) b)
|
||||
#define emsg3(a, b, c) emsg3((char_u *) a, (char_u *) b, (char_u *) c)
|
||||
#define emsgu(a, ...) emsgu((char_u *) a, __VA_ARGS__)
|
||||
|
@ -167,7 +167,7 @@ enum SRNIFlags {
|
|||
kSDReadBufferList = (1 << kSDItemBufferList), ///< Determines whether buffer
|
||||
///< list should be read
|
||||
///< (disabled by removing
|
||||
///< % entry from viminfo).
|
||||
///< % entry from &viminfo).
|
||||
kSDReadUnknown = (1 << (SHADA_LAST_ENTRY + 1)), ///< Determines whether
|
||||
///< unknown items should be
|
||||
///< read (usually disabled).
|
||||
|
@ -200,6 +200,7 @@ typedef struct {
|
|||
int64_t offset;
|
||||
bool is_last_used;
|
||||
bool is_substitute_pattern;
|
||||
// TODO(ZyX-I): Also store v:hlsearch, see :h shada-h
|
||||
char *pat;
|
||||
Dictionary *additional_data;
|
||||
} search_pattern;
|
||||
|
@ -524,7 +525,7 @@ int shada_read_file(const char *const file, const int flags)
|
|||
|
||||
if (p_verbose > 0) {
|
||||
verbose_enter();
|
||||
smsg(_("Reading viminfo file \"%s\"%s%s%s"),
|
||||
smsg(_("Reading ShaDa file \"%s\"%s%s%s"),
|
||||
fname,
|
||||
(flags & kShaDaWantInfo) ? _(" info") : "",
|
||||
(flags & kShaDaWantMarks) ? _(" marks") : "",
|
||||
|
@ -672,21 +673,22 @@ static inline bool marks_equal(const pos_T a, const pos_T b)
|
|||
static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
// TODO(ZyX-I): Also load v:oldfiles.
|
||||
unsigned srni_flags = 0;
|
||||
if (flags & kShaDaWantInfo) {
|
||||
srni_flags |= kSDReadUndisableableData | kSDReadRegisters;
|
||||
if (p_hi) {
|
||||
srni_flags |= kSDReadHistory;
|
||||
}
|
||||
if (find_viminfo_parameter('!') != NULL) {
|
||||
if (find_shada_parameter('!') != NULL) {
|
||||
srni_flags |= kSDReadVariables;
|
||||
}
|
||||
if (find_viminfo_parameter('%') != NULL && ARGCOUNT == 0) {
|
||||
if (find_shada_parameter('%') != NULL && ARGCOUNT == 0) {
|
||||
srni_flags |= kSDReadBufferList;
|
||||
}
|
||||
}
|
||||
if (flags & kShaDaWantMarks) {
|
||||
if (get_viminfo_parameter('\'') > 0) {
|
||||
if (get_shada_parameter('\'') > 0) {
|
||||
srni_flags |= kSDReadLocalMarks;
|
||||
}
|
||||
}
|
||||
|
@ -1039,7 +1041,7 @@ static char *shada_filename(const char *file)
|
|||
if (file == NULL || *file == NUL) {
|
||||
if (used_shada_file != NULL) {
|
||||
file = used_shada_file;
|
||||
} else if ((file = find_viminfo_parameter('n')) == NULL || *file == NUL) {
|
||||
} else if ((file = find_shada_parameter('n')) == NULL || *file == NUL) {
|
||||
#ifdef SHADA_FILE2
|
||||
// don't use $HOME when not defined (turned into "c:/"!).
|
||||
if (os_getenv((char_u *)"HOME") == NULL) {
|
||||
|
@ -1364,7 +1366,7 @@ static void shada_write(ShaDaWriteDef *const sd_writer,
|
|||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
khash_t(bufset) *const removable_bufs = kh_init(bufset);
|
||||
int max_kbyte_i = get_viminfo_parameter('s');
|
||||
int max_kbyte_i = get_shada_parameter('s');
|
||||
if (max_kbyte_i < 0) {
|
||||
max_kbyte_i = 10;
|
||||
}
|
||||
|
@ -1409,7 +1411,7 @@ static void shada_write(ShaDaWriteDef *const sd_writer,
|
|||
}, 0);
|
||||
|
||||
// 2. Buffer list
|
||||
if (find_viminfo_parameter('%') != NULL) {
|
||||
if (find_shada_parameter('%') != NULL) {
|
||||
size_t buf_count = 0;
|
||||
FOR_ALL_BUFFERS(buf) {
|
||||
if (buf->b_ffname != NULL && !SHADA_REMOVABLE(buf)) {
|
||||
|
@ -1498,7 +1500,7 @@ static void shada_write(ShaDaWriteDef *const sd_writer,
|
|||
// 4. History
|
||||
HistoryMergerState hms[HIST_COUNT];
|
||||
for (uint8_t i = 0; i < HIST_COUNT; i++) {
|
||||
long num_saved = get_viminfo_parameter(hist_type2char(i));
|
||||
long num_saved = get_shada_parameter(hist_type2char(i));
|
||||
if (num_saved == -1) {
|
||||
num_saved = p_hi;
|
||||
}
|
||||
|
@ -1599,7 +1601,7 @@ static void shada_write(ShaDaWriteDef *const sd_writer,
|
|||
}
|
||||
|
||||
// 7. Global marks
|
||||
if (get_viminfo_parameter('f') != 0) {
|
||||
if (get_shada_parameter('f') != 0) {
|
||||
ShadaEntry *const global_marks = list_global_marks(removable_bufs);
|
||||
for (ShadaEntry *mark = global_marks; mark->type != kSDItemMissing;
|
||||
mark++) {
|
||||
|
@ -1636,12 +1638,12 @@ static void shada_write(ShaDaWriteDef *const sd_writer,
|
|||
}
|
||||
}
|
||||
// FIXME: Copy previous marks, up to num_marked_files
|
||||
// size_t num_marked_files = get_viminfo_parameter('\'');
|
||||
// size_t num_marked_files = get_shada_parameter('\'');
|
||||
|
||||
// 9. Registers
|
||||
int max_num_lines_i = get_viminfo_parameter('<');
|
||||
int max_num_lines_i = get_shada_parameter('<');
|
||||
if (max_num_lines_i < 0) {
|
||||
max_num_lines_i = get_viminfo_parameter('"');
|
||||
max_num_lines_i = get_shada_parameter('"');
|
||||
}
|
||||
if (max_num_lines_i != 0) {
|
||||
const size_t max_num_lines = (max_num_lines_i < 0
|
||||
|
@ -1673,7 +1675,7 @@ static void shada_write(ShaDaWriteDef *const sd_writer,
|
|||
}
|
||||
|
||||
// 10. Variables
|
||||
if (find_viminfo_parameter('!') != NULL) {
|
||||
if (find_shada_parameter('!') != NULL) {
|
||||
const void *var_iter = NULL;
|
||||
const Timestamp cur_timestamp = os_time();
|
||||
do {
|
||||
|
@ -1730,6 +1732,7 @@ int shada_write_file(const char *const file, bool nomerge)
|
|||
intptr_t fd;
|
||||
|
||||
if (!nomerge) {
|
||||
// TODO(ZyX-I): Fail on read error.
|
||||
if (open_shada_file_for_reading(fname, &sd_reader) != OK) {
|
||||
nomerge = true;
|
||||
goto shada_write_file_nomerge;
|
||||
|
@ -1741,6 +1744,7 @@ int shada_write_file(const char *const file, bool nomerge)
|
|||
}
|
||||
|
||||
shada_write_file_open:
|
||||
// TODO(ZyX-I): Preserve existing permissions
|
||||
fd = (intptr_t) open_file(tempname, O_CREAT|O_WRONLY|O_NOFOLLOW|O_EXCL,
|
||||
0600);
|
||||
if (fd < 0) {
|
||||
|
@ -1754,6 +1758,8 @@ shada_write_file_open:
|
|||
if (*wp == 'z') {
|
||||
// Tried names from .tmp.a to .tmp.z, all failed. Something must be
|
||||
// wrong then.
|
||||
EMSG2(_("E138: All %s.tmp.X files exist, cannot write ShaDa file!"),
|
||||
fname);
|
||||
xfree(fname);
|
||||
xfree(tempname);
|
||||
return FAIL;
|
||||
|
@ -1772,7 +1778,7 @@ shada_write_file_nomerge:
|
|||
|
||||
if (p_verbose > 0) {
|
||||
verbose_enter();
|
||||
smsg(_("Writing viminfo file \"%s\""), fname);
|
||||
smsg(_("Writing ShaDa file \"%s\""), fname);
|
||||
verbose_leave();
|
||||
}
|
||||
|
||||
|
@ -1793,7 +1799,7 @@ shada_write_file_nomerge:
|
|||
if (!nomerge) {
|
||||
close_file((int)(intptr_t) sd_reader.cookie);
|
||||
if (vim_rename(tempname, fname) == -1) {
|
||||
EMSG3(_("E886: Can't rename viminfo file from %s to %s!"),
|
||||
EMSG3(_("E886: Can't rename ShaDa file from %s to %s!"),
|
||||
tempname, fname);
|
||||
} else {
|
||||
os_remove(tempname);
|
||||
|
@ -3021,7 +3027,7 @@ bool shada_removable(const char *name)
|
|||
size_t n;
|
||||
|
||||
char *new_name = home_replace_save(NULL, name);
|
||||
for (p = (char *) p_viminfo; *p; ) {
|
||||
for (p = (char *) p_shada; *p; ) {
|
||||
(void) copy_option_part(&p, part, 51, ", ");
|
||||
if (part[0] == 'r') {
|
||||
n = STRLEN(part + 1);
|
||||
|
|
|
@ -4,7 +4,7 @@ local clear, execute, eq, neq, spawn, nvim_prog, set_session, wait, write_file
|
|||
helpers.nvim_prog, helpers.set_session, helpers.wait, helpers.write_file
|
||||
|
||||
describe(':wviminfo', function()
|
||||
local viminfo_file = 'wviminfo_test'
|
||||
local shada_file = 'wviminfo_test'
|
||||
local session
|
||||
|
||||
before_each(function()
|
||||
|
@ -17,38 +17,41 @@ describe(':wviminfo', function()
|
|||
'--cmd', 'set swapfile'})
|
||||
set_session(session)
|
||||
|
||||
os.remove(viminfo_file)
|
||||
os.remove(shada_file)
|
||||
end)
|
||||
|
||||
it('creates a viminfo file', function()
|
||||
it('creates a shada file', function()
|
||||
-- file should _not_ exist
|
||||
eq(nil, lfs.attributes(viminfo_file))
|
||||
execute('wv! '..viminfo_file)
|
||||
eq(nil, lfs.attributes(shada_file))
|
||||
execute('wv! '..shada_file)
|
||||
wait()
|
||||
-- file _should_ exist
|
||||
neq(nil, lfs.attributes(viminfo_file))
|
||||
neq(nil, lfs.attributes(shada_file))
|
||||
end)
|
||||
|
||||
it('overwrites existing files', function()
|
||||
local text = 'wviminfo test'
|
||||
|
||||
-- Create a dummy file
|
||||
write_file(viminfo_file, text)
|
||||
write_file(shada_file, text)
|
||||
|
||||
-- sanity check
|
||||
eq(text, io.open(viminfo_file):read())
|
||||
neq(nil, lfs.attributes(viminfo_file))
|
||||
eq(text, io.open(shada_file):read())
|
||||
neq(nil, lfs.attributes(shada_file))
|
||||
|
||||
execute('wv! '..viminfo_file)
|
||||
execute('wv! '..shada_file)
|
||||
wait()
|
||||
|
||||
-- File should have been overwritten with a viminfo file.
|
||||
local line1 = io.lines(viminfo_file)()
|
||||
assert(nil ~= string.find(line1, 'This viminfo file was generated by Nvim'),
|
||||
viminfo_file..' should be a viminfo-formatted file')
|
||||
-- File should have been overwritten with a shada file.
|
||||
local fp = io.open(shada_file, 'r')
|
||||
local char1 = fp:read(1)
|
||||
fp:close()
|
||||
-- ShaDa file starts with a “header” entry
|
||||
assert(char1:byte() == 0x01,
|
||||
shada_file..' should be a shada file')
|
||||
end)
|
||||
|
||||
teardown(function()
|
||||
os.remove(viminfo_file)
|
||||
os.remove(shada_file)
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
-- Tests for storing global variables in the .viminfo file
|
||||
-- Tests for storing global variables in the .shada file
|
||||
|
||||
local helpers, lfs = require('test.functional.helpers'), require('lfs')
|
||||
local clear, execute, eq, neq, eval, wait, spawn =
|
||||
helpers.clear, helpers.execute, helpers.eq, helpers.neq, helpers.eval,
|
||||
helpers.wait, helpers.spawn
|
||||
|
||||
describe('storing global variables in viminfo files', function()
|
||||
describe('storing global variables in ShaDa files', function()
|
||||
local tempname = 'Xtest-functional-legacy-074'
|
||||
setup(function()
|
||||
clear()
|
||||
os.remove("Xviminfo")
|
||||
os.remove(tempname)
|
||||
end)
|
||||
|
||||
it('is working', function()
|
||||
|
@ -29,31 +30,32 @@ describe('storing global variables in viminfo files', function()
|
|||
'set visualbell',
|
||||
'set viminfo+=!',
|
||||
"let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}",
|
||||
-- Store a really long list, so line wrapping will occur in viminfo
|
||||
-- file.
|
||||
-- Store a really long list. Initially this was testing line wrapping in
|
||||
-- viminfo, but shada files has no line wrapping, no matter how long the
|
||||
-- list is.
|
||||
'let MY_GLOBAL_LIST=range(1,100)'
|
||||
)
|
||||
eq(test_dict, eval('MY_GLOBAL_DICT'))
|
||||
eq(test_list, eval('MY_GLOBAL_LIST'))
|
||||
|
||||
execute('wv! Xviminfo')
|
||||
execute('wv! ' .. tempname)
|
||||
wait()
|
||||
|
||||
-- Assert that the viminfo file exists.
|
||||
neq(nil, lfs.attributes('Xviminfo'))
|
||||
-- Assert that the shada file exists.
|
||||
neq(nil, lfs.attributes(tempname))
|
||||
execute('unlet MY_GLOBAL_DICT',
|
||||
'unlet MY_GLOBAL_LIST')
|
||||
-- Assert that the variables where deleted.
|
||||
eq(0, eval('exists("MY_GLOBAL_DICT")'))
|
||||
eq(0, eval('exists("MY_GLOBAL_LIST")'))
|
||||
|
||||
execute('rv! Xviminfo')
|
||||
execute('rv! ' .. tempname)
|
||||
|
||||
eq(test_list, eval('MY_GLOBAL_LIST'))
|
||||
eq(test_dict, eval('MY_GLOBAL_DICT'))
|
||||
end)
|
||||
|
||||
teardown(function()
|
||||
os.remove('Xviminfo')
|
||||
os.remove(tempname)
|
||||
end)
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue