diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-04-22 13:40:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-22 13:40:41 -0400 |
| commit | 28ba06837281e14a7dc5ade143642d11475d2823 (patch) | |
| tree | e60f0b3aa160e820d2fade9e3973281d7ddc581c /runtime/lua/vim/_core/server.lua | |
| parent | fb6aeaba2d3a38c7febd0a39cabd89685de11b9d (diff) | |
feat(:restart): v:starttime, v:exitreason #39282
Problem:
- The `ZR` feature makes it more obvious that we need some sort of flag so that
an `ExitPre` / `QuitPre` / `VimLeave` handler can handle restarts differently
than a normal exit. For example, it's common that users want `:mksession` on
restart, but perhaps not on a normal exit.
- Nvim has no way to report its "uptime".
Solution:
- Introduce `v:starttime`
- Introduce `v:exitreason`
Diffstat (limited to 'runtime/lua/vim/_core/server.lua')
| -rw-r--r-- | runtime/lua/vim/_core/server.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/lua/vim/_core/server.lua b/runtime/lua/vim/_core/server.lua index 9c18b3811e..8ffcb97449 100644 --- a/runtime/lua/vim/_core/server.lua +++ b/runtime/lua/vim/_core/server.lua @@ -46,10 +46,10 @@ M.restart_canonical_addr = nil ---@type string? --- Windows named pipes can't be rebound immediately, so the new server starts on a --- temporary bootstrap address and polls until the canonical address is reclaimable. --- @param canonical_addr string The original --listen address to reclaim. ---- @param bootstrap_addr string Temporary address the new server started on. --- @param expected_uis integer Number of UIs expected to reattach (0 = don't wait). -function M.rebind_old_addr_after_restart(canonical_addr, bootstrap_addr, expected_uis) +function M.rebind_after_restart(canonical_addr, expected_uis) M.restart_canonical_addr = canonical_addr + local bootstrap_addr = vim.v.servername -- Temporary autogenerated address. local poll_ms = 50 local max_wait_ms = 30000 local timer = assert(vim.uv.new_timer()) |
