diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 9 | ||||
-rw-r--r-- | src/nvim/options.lua | 15 | ||||
-rw-r--r-- | src/nvim/testdir/test_mksession.vim | 42 |
3 files changed, 55 insertions, 11 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index c109e4e521..fae4507f1e 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -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; } diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 3280c92b2d..52e788944b 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -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', diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 4e6d96ee48..0e56ed2ff3 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -267,4 +267,46 @@ func Test_mksession_quote_in_filename() call delete('Xtest_mks_quoted.out') endfunc +func s:ClearMappings() + mapclear + omapclear + mapclear! + lmapclear + tmapclear +endfunc + +func Test_mkvimrc() + let entries = [ + \ ['', 'nothing', '<Nop>'], + \ ['n', 'normal', 'NORMAL'], + \ ['v', 'visual', 'VISUAL'], + \ ['s', 'select', 'SELECT'], + \ ['x', 'visualonly', 'VISUALONLY'], + \ ['o', 'operator', 'OPERATOR'], + \ ['i', 'insert', 'INSERT'], + \ ['l', 'lang', 'LANG'], + \ ['c', 'command', 'COMMAND'], + \ ['t', 'terminal', 'TERMINAL'], + \ ] + for entry in entries + exe entry[0] .. 'map ' .. entry[1] .. ' ' .. entry[2] + endfor + + mkvimrc Xtestvimrc + + call s:ClearMappings() + for entry in entries + call assert_equal('', maparg(entry[1], entry[0])) + endfor + + source Xtestvimrc + + for entry in entries + call assert_equal(entry[2], maparg(entry[1], entry[0])) + endfor + + call s:ClearMappings() + call delete('Xtestvimrc') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |