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:
parent
e387a57c0e
commit
91f4b13810
2 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue