From c3ef0481445c539b0079cf23797570ab3330f808 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 18 Mar 2026 15:29:07 -0400 Subject: [PATCH] fix(init): load oil buffer when BufAdd hijack fires under trouble/bqf Problem: `BufAdd` handler renames a directory buffer to its `oil://` URL and relies on the resulting `BufReadCmd` to load it. Plugins like trouble.nvim that intercept quickfix opening suppress nested autocmds, so `BufReadCmd` never fires and the buffer is left blank. Solution: call `load_oil_buffer` directly after a successful hijack, matching the startup loop which already does this. `load_oil_buffer` guards against double-loading, so normal-path callers where `BufReadCmd` does fire are unaffected. --- lua/oil/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/oil/init.lua b/lua/oil/init.lua index dbf5296..3f4c414 100644 --- a/lua/oil/init.lua +++ b/lua/oil/init.lua @@ -1646,7 +1646,9 @@ M.setup = function(opts) pattern = '*', nested = true, callback = function(params) - maybe_hijack_directory_buffer(params.buf) + if maybe_hijack_directory_buffer(params.buf) and vim.v.vim_did_enter == 1 then + M.load_oil_buffer(params.buf) + end end, })