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.
This commit is contained in:
Barrett Ruth 2026-03-18 15:29:07 -04:00
parent 499bae1975
commit c3ef048144
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -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,
})