I did some digging, and I think the issue is happening in the delete_hidden_buffers function in lua/oil/view.lua:
M.delete_hidden_buffers = function()
local visible_buffers, hidden_buffers = get_visible_hidden_buffers()
if not visible_buffers or not hidden_buffers or not vim.tbl_isempty(visible_buffers) then
return
end
for _, bufnr in ipairs(hidden_buffers) do
vim.api.nvim_buf_delete(bufnr, { force = true })
end
cache.clear_everything()
end
Calling vim.api.nvim_buf_delete throws the error. Taking a look at the old issues, it looks like it was fixed in a different part of the code base: https://github.com/stevearc/oil.nvim/issues/378. It looks like it was fixed by simply exiting before the call to close. Maybe the same solution could be applied here?
This is my first time opening an issue, so I would appreciate any feedback you have. Also, I would love to help out in fixing the issue if possible. Thanks for an awesome plugin!
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
nvim -u repro.lua
Enter command :Oil
Open a file
Before the cleanup delay expires (2 seconds), enter command :q
You should then see the error after the cleanup delay expires.
Expected Behavior
I wouldn't expect to see anything. Oil should handle the buffers in the background.
Directory structure
N/A
Repro
-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"stevearc/oil.nvim",
config = function()
require("oil").setup({
-- add any needed settings here
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Did you check the bug with a clean config?
[X] I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.
Did you check the docs and existing issues?
Neovim version (nvim -v)
0.11.0 commit 4f24e1b
Operating system/version
Fedora 40
Describe the bug
When opening a file from Oil, and then opening a command window (e.g.,
q:
) I receive this error:Error executing vim.schedule lua callback: .../colten/.local/share/nvim/lazy/oil.nvim/lua/oil/view.lua:219: E11: Invalid in command-line window; executes, CTRL-C quits
I did some digging, and I think the issue is happening in the delete_hidden_buffers function in lua/oil/view.lua:
Calling
vim.api.nvim_buf_delete
throws the error. Taking a look at the old issues, it looks like it was fixed in a different part of the code base: https://github.com/stevearc/oil.nvim/issues/378. It looks like it was fixed by simply exiting before the call to close. Maybe the same solution could be applied here?This is my first time opening an issue, so I would appreciate any feedback you have. Also, I would love to help out in fixing the issue if possible. Thanks for an awesome plugin!
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
:Oil
:q
You should then see the error after the cleanup delay expires.
Expected Behavior
I wouldn't expect to see anything. Oil should handle the buffers in the background.
Directory structure
N/A
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.