mirror of
https://github.com/neovim/neovim.git
synced 2026-08-31 03:13:48 +00:00
feat(:restart)!: ":restart" (no bang) saves/restores session #40321
Problem: `:restart` does not preserve window layout, etc. Solution: - Change `:restart` to save/restore a session automatically. - Introduce "bang" variant `:restart!` to restart *without* session save/restore. - Introduce `v:startreason`. - `ZR` maps to `:restart!`.
This commit is contained in:
@@ -402,8 +402,8 @@ describe('startup --listen', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
it(':restart works in headless server (no UI)', function()
|
||||
t.skip(is_os('win'), 'FIXME: --listen not preserved by :restart on Windows')
|
||||
it(':restart! works in headless server (no UI)', function()
|
||||
t.skip(is_os('win'), 'FIXME: --listen not preserved by :restart! on Windows')
|
||||
|
||||
local nvim0 = clear()
|
||||
local server_pipe = n.new_pipename()
|
||||
@@ -428,14 +428,14 @@ it(':restart works in headless server (no UI)', function()
|
||||
end)
|
||||
n.set_session(n.connect(server_pipe))
|
||||
|
||||
n.expect_exit(n.command, 'restart')
|
||||
n.expect_exit(n.command, 'restart!')
|
||||
n.set_session(n.connect(server_pipe))
|
||||
eq(1, api.nvim_get_vvar('vim_did_enter'))
|
||||
eq('restart', api.nvim_get_vvar('startreason'))
|
||||
eq('restart', n.eval('g:early_startreason'))
|
||||
eq('restart!', api.nvim_get_vvar('startreason'))
|
||||
eq('restart!', n.eval('g:early_startreason'))
|
||||
|
||||
-- TODO: [command] is currently not executed without UI
|
||||
-- n.expect_exit(n.command, 'restart lua _G.new_server = 1')
|
||||
-- n.expect_exit(n.command, 'restart! lua _G.new_server = 1')
|
||||
-- n.set_session(n.connect(server_pipe))
|
||||
-- eq(1, n.exec_lua('return _G.new_server'))
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user