mirror of
https://github.com/neovim/neovim.git
synced 2026-05-02 12:04:58 +00:00
findoption_len: treat viminfo/viminfofile as aliases
Ref: https://github.com/neovim/neovim/pull/10672#issuecomment-524716824
This commit is contained in:
@@ -4643,6 +4643,15 @@ int findoption_len(const char *const arg, const size_t len)
|
||||
}
|
||||
if (s == NULL) {
|
||||
opt_idx = -1;
|
||||
} else {
|
||||
// Nvim: handle option aliases.
|
||||
if (STRNCMP(options[opt_idx].fullname, "viminfo", 7) == 0) {
|
||||
if (STRLEN(options[opt_idx].fullname) == 7) {
|
||||
return findoption_len("shada", 5);
|
||||
}
|
||||
assert(STRCMP(options[opt_idx].fullname, "viminfofile") == 0);
|
||||
return findoption_len("shadafile", 9);
|
||||
}
|
||||
}
|
||||
return opt_idx;
|
||||
}
|
||||
|
||||
@@ -2659,21 +2659,14 @@ return {
|
||||
defaults={if_true={vi="folds,options,cursor,curdir"}}
|
||||
},
|
||||
{
|
||||
-- Alias for "shada".
|
||||
full_name='viminfo', abbreviation='vi',
|
||||
type='string', list='onecomma', scope={'global'},
|
||||
deny_duplicates=true,
|
||||
secure=true,
|
||||
varname='p_shada',
|
||||
defaults={if_true={vi="", vim="!,'100,<50,s10,h"}}
|
||||
type='string', scope={'global'}, nodefault=true,
|
||||
},
|
||||
{
|
||||
-- Alias for "shadafile".
|
||||
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=""}}
|
||||
type='string', scope={'global'}, nodefault=true,
|
||||
},
|
||||
{
|
||||
full_name='virtualedit', abbreviation='ve',
|
||||
|
||||
@@ -178,6 +178,12 @@ describe('startup defaults', function()
|
||||
eq({ f }, eval('v:oldfiles'))
|
||||
os.remove('Xtest-foo')
|
||||
rmdir('Xtest-userdata')
|
||||
|
||||
-- Handles viminfo/viminfofile as alias for shada/shadafile.
|
||||
eq('\n shadafile=', eval('execute("set shadafile?")'))
|
||||
eq('\n shadafile=', eval('execute("set viminfofile?")'))
|
||||
eq("\n shada=!,'100,<50,s10,h", eval('execute("set shada?")'))
|
||||
eq("\n shada=!,'100,<50,s10,h", eval('execute("set viminfo?")'))
|
||||
end)
|
||||
|
||||
it("'packpath'", function()
|
||||
|
||||
Reference in New Issue
Block a user