From 08dd3adffb60ae6c031f9b8310febd65bb14604e Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 10 Sep 2026 03:42:20 +0800 Subject: feat(api): add ev.win to autocmd callback args #39826 Problem: Autocmd callbacks currently have to rely on curwin, which may already have changed by the time they run. This is especially noticeable for WinNew, WinClosed, WinResized and WinScrolled. Solution: Track the window in the autocmd context and expose it as ev.win. Pass it explicitly for the window events that need it. --- runtime/lua/vim/_meta/api_keysets_extra.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/_meta/api_keysets_extra.lua') diff --git a/runtime/lua/vim/_meta/api_keysets_extra.lua b/runtime/lua/vim/_meta/api_keysets_extra.lua index acc23be54e..c1d574707d 100644 --- a/runtime/lua/vim/_meta/api_keysets_extra.lua +++ b/runtime/lua/vim/_meta/api_keysets_extra.lua @@ -76,6 +76,7 @@ error('Cannot require a meta file') --- @field match string expanded value of --- @field buf integer expanded value of --- @field file string expanded value of +--- @field win integer id of the window for the event, see |window-ID| --- @field data? any arbitrary data passed from |nvim_exec_autocmds()| --- @class vim.api.keyset.create_user_command.command_args -- cgit