mirror of
https://github.com/neovim/neovim.git
synced 2026-08-04 06:38:44 +00:00
feat(:restart): v:startreason #40186
Problem:
It's clumsy for scripts to handle a "restart", without custom mappings or
global vars.
Solution:
Introduce `v:startreason`
(cherry picked from commit ae426ee465)
This commit is contained in:
committed by
Olivia Kinnear
parent
a4985ac902
commit
611b4f8237
@@ -364,7 +364,15 @@ it(':restart works in headless server (no UI)', function()
|
||||
n.set_session(nil)
|
||||
end)
|
||||
|
||||
fn.jobstart({ n.nvim_prog, '--clean', '--headless', '--listen', server_pipe })
|
||||
fn.jobstart({
|
||||
n.nvim_prog,
|
||||
'--clean',
|
||||
'--headless',
|
||||
'--listen',
|
||||
server_pipe,
|
||||
'--cmd',
|
||||
'let g:early_startreason = v:startreason',
|
||||
})
|
||||
t.retry(nil, nil, function()
|
||||
neq(nil, vim.uv.fs_stat(server_pipe))
|
||||
end)
|
||||
@@ -373,6 +381,8 @@ it(':restart works in headless server (no UI)', function()
|
||||
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'))
|
||||
|
||||
-- TODO: [command] is currently not executed without UI
|
||||
-- n.expect_exit(n.command, 'restart lua _G.new_server = 1')
|
||||
|
||||
Reference in New Issue
Block a user