fix(picker): prevent WinEnter handling during startup

When opening Neovim with a directory argument (e.g., `nvim .`), the
explorer's preview window was not being shown automatically. This was
because the WinEnter autocmd in the picker was triggering during the
startup sequence before VimEnter, interfering with the initialization.

The fix adds a check for `vim.v.vim_did_enter == 0` to skip the window
management logic during startup, allowing the explorer to properly
initialize with its preview window enabled.

Fixes #2257 (second issue)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Folke Lemaitre 2025-10-21 13:16:04 +02:00
parent aafa55d839
commit 756a791131
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -291,6 +291,9 @@ function M:attach()
-- close if we enter a window that is not part of the picker
local preview = false
self.layout.root:on("WinEnter", function()
if vim.v.vim_did_enter == 0 then
return
end
if self.closed or Snacks.util.is_float() then
return
end