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:
Nathan Zeng
2026-06-18 12:49:12 -07:00
committed by Olivia Kinnear
parent a4985ac902
commit 611b4f8237
12 changed files with 69 additions and 3 deletions

View File

@@ -667,6 +667,14 @@ vim.v.shell_error = ...
--- @type table[]
vim.v.stacktrace = ...
--- The reason Nvim started. Possible values:
--- - "normal" normal startup.
--- - "restart" started by `:restart` or `ZR`.
---
--- Read-only.
--- @type string
vim.v.startreason = ...
--- Timestamp (nanoseconds since UNIX epoch) when the Nvim process
--- started.
---