Open VoreckLukas opened 2 months ago
Please ensure you are on the most recent version of oil and provide a minimal init.lua file, such as provided in the bug report template. Ensure that the error reproduces when using that minimal init file.
Please ensure you are on the most recent version of oil and provide a minimal init.lua file, such as provided in the bug report template. Ensure that the error reproduces when using that minimal init file.
Where can i see the version?
I have provided the minimal init file which im using and I can reliably reproduce it. to prove it I have a gif here
Oh I just realized that the repro.lua in the template also has stuff to change paths etc. still with the exact template from the bug report (
-- 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
) It still happens exactly the same, perfectly reproducible
I have the same issue. Neovim version: v0.9.5 on NixOS unstable. This only happens when using open_float()
I have the same issue
$ nvim -v
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1693350652
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/nix/store/aszfdv0palw8vgpswijvgn273fip4306-neovim-unwrapped-0.9.5/share/nvim
"
Run :checkhealth for more info
Only in floating mode.
Crazy, this seems to only be happening in NixOS, and the issue is that where we expect to have the oil bufnr, instead we have a handle to the repro.lua
bufnr. That means that somewhere in this block of code the current buffer changes from the oil buffer to the target file.
https://github.com/stevearc/oil.nvim/blob/010b44a79d497c697686e2727049d3dd215bbbd6/lua/oil/init.lua#L589-L643
There shouldn't be any way for that to happen, and it especially shouldn't be platform-dependent. I added a couple of debug print statements to this branch: https://github.com/stevearc/oil.nvim/tree/stevearc-nix-test Could you do the repro again and show me what it prints when the error happens?
and it especially shouldn't be platform-dependent
For me, the issue occurs now only when I install and set up Oil through nixos package-manager. With Lazy everything works good, without any errors.
when installing oil like this
package = pkgs.vimUtils.buildVimPlugin {
pname = "oil.nvim";
version = "2023-11-16";
src = pkgs.fetchFromGitHub {
owner = "stevearc";
repo = "oil.nvim";
rev = "3151d9dd616ea33fa219dd4b198f01c49d8f76c3";
sha256 = "17mi1hs3jmmrxqxhykqf0xj91ssxzzzig7gmdlyak6pgwln2ziyr";
fetchSubmodules = true;
};
meta.homepage = "https://github.com/stevearc/oil.nvim/";
};
To check out your branch it doesn't happen anymore @stevearc
@VoreckLukas that's concerning, because all I did in that branch is add some print statements. That might indicate that the issue is a very consistent race condition. I've reworked that branch to write to a log file instead of printing to hopefully get the error to trigger again. If you can get it to repro, the logs should be under ~/.local/state/nvim/oil.log
(or if your XDG directories are different on NixOS, you can find the dir with :echo stdpath('log')
).
I was a bit busy the last few Weeks and will try the branch out in a few days. Has to be noted though that the standard package delivered by nixpkgs works again
Did you check the docs and existing issues?
Neovim version (nvim -v)
NVIM v0.9.5
Operating system/version
NixOS Unstable
Describe the bug
Whenever I try to open a file with oil i get the error above along with the following:
It seems to only happen when oil is opened floating
What is the severity of this bug?
breaking (some functionality is broken)
Steps To Reproduce
:lua require("oil").open_float()
Expected Behavior
The file should be opened
Directory structure
Any
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.