From 36c07875d2db7de52627f581c228ccb1289ce693 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 18 Mar 2026 13:23:19 -0400 Subject: [PATCH] fix(init): skip WinNew split handler before VimEnter 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 --- doc/upstream.md | 2 +- lua/oil/init.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/upstream.md b/doc/upstream.md index 9e1b9a9..17f4953 100644 --- a/doc/upstream.md +++ b/doc/upstream.md @@ -54,7 +54,7 @@ issues against this fork. | [#298](https://github.com/stevearc/oil.nvim/issues/298) | Open float on neovim directory startup | open | | [#302](https://github.com/stevearc/oil.nvim/issues/302) | `buflisted=true` after jumplist nav | fixed ([#71](https://github.com/barrettruth/canola.nvim/pull/71)) | | [#303](https://github.com/stevearc/oil.nvim/issues/303) | Preview in float window mode | fixed — upstream [#403](https://github.com/stevearc/oil.nvim/pull/403), `config.float.preview_split` | -| [#325](https://github.com/stevearc/oil.nvim/issues/325) | oil-ssh error from command line | consolidated into [#164](https://github.com/barrettruth/canola.nvim/issues/164) | +| [#325](https://github.com/stevearc/oil.nvim/issues/325) | oil-ssh error from command line | fixed | | [#330](https://github.com/stevearc/oil.nvim/issues/330) | Telescope opens file in oil float | not actionable — cross-plugin, no repro | | [#332](https://github.com/stevearc/oil.nvim/issues/332) | Buffer not fixed to floating window | not actionable — cannot reproduce | | [#335](https://github.com/stevearc/oil.nvim/issues/335) | Disable editing outside root dir | not actionable — confirmation prompt and `delete_to_trash` already cover accidental deletion | diff --git a/lua/oil/init.lua b/lua/oil/init.lua index f4c2211..f71f52e 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -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