startup: -es/-Es (silent/batch mode): skip swapfile #8540

To use Nvim as a scripting engine the side-effects of swapfiles and user
config should be avoided by default.
This commit is contained in:
Justin M. Keyes
2019-04-10 03:27:25 +02:00
committed by GitHub
parent 9daa7d9978
commit ddd0eb6f51
4 changed files with 28 additions and 8 deletions

View File

@@ -203,6 +203,20 @@ describe('startup', function()
{ 'set encoding', '' }))
end)
it('-es/-Es disables swapfile, user config #8540', function()
for _,arg in ipairs({'-es', '-Es'}) do
local out = funcs.system({nvim_prog, arg,
'+set swapfile? updatecount? shada?',
"+put =execute('scriptnames')", '+%print'})
local line1 = string.match(out, '^.-\n')
-- updatecount=0 means swapfile was disabled.
eq(" swapfile updatecount=0 shada=!,'100,<50,s10,h\n", line1)
-- Standard plugins were loaded, but not user config.
eq('health.vim', string.match(out, 'health.vim'))
eq(nil, string.match(out, 'init.vim'))
end
end)
it('does not crash if --embed is given twice', function()
clear{args={'--embed'}}
eq(2, eval('1+1'))