fix(init): skip WinNew split handler before VimEnter (#172)

Problem: running `nvim oil-ssh://host/` from the command line sometimes
emits "Oil split could not find parent window" immediately on startup.
The `WinNew` autocmd that transfers oil window vars to new splits fires
during startup before `BufEnter` has set `oil_did_enter` on any window,
so the parent search finds nothing and warns.

Solution: guard the callback with `vim.v.vim_did_enter ~= 1` so it is
silently skipped during the pre-`VimEnter` startup phase. After
`VimEnter` the split-transfer logic runs unchanged. `vim_did_enter` is
already used in `setup()` for the same startup-completion check.

Based on: stevearc/oil.nvim#325
This commit is contained in:
Barrett Ruth 2026-03-18 13:26:58 -04:00 committed by GitHub
parent e387a57c0e
commit 91f4b13810
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -1566,6 +1566,9 @@ M.setup = function(opts)
pattern = '*',
nested = true,
callback = function(params)
if vim.v.vim_did_enter ~= 1 then
return
end
local util = require('oil.util')
if not util.is_oil_bufnr(params.buf) or vim.w.oil_did_enter then
return