mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
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:
parent
aafa55d839
commit
756a791131
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue