-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Oil buffer takes time to close after opening a file #45
Comments
Let me first explain what's happening, and why it's happening.
I figured that most people probably don't want to have to clean these all up manually, and also don't want them sticking around, which is why I opted to do this auto-cleanup logic. What does your workflow look like, that you want to switch back to oil using buffer navigation? For me, I'm typically only using oil when it's visible. If I understand how you're using it, I might be able to offer you a better solution than just "you have to manually dispose all of the oil buffers now," though that is also an option if it's what you want. |
That explains what I'm seeing and really makes sens. The only thing that bugs me a little is the delay in cleaning of 2 seconds. Is there a reason for having 2 second delay in cleaning up? And also why not reuse the same buffer, instead if creating new ones on each directory change? Anyways, nothing critical, I love your plugin! |
The 2 second delay is both a small optimization (if you return to that directory in the next 2 seconds, which is not unlikely, we don't have to rebuild the whole thing) and prevents unexpected behavior when interacting with other plugins. Sometimes plugins have to do a bunch of window/buffer switching all at once so quickly that it's invisible to the user, but that might still trigger a BufHidden event. This delay makes sure that the buffer is actually not visible to the user anymore by giving it some time to settle. Is 2 seconds the right number? Not sure. Opinions on that are welcome. We can't re-use the same buffer because of how oil works, unfortunately. We have to keep every directory completely isolated so that we can track the edits independently. I mentioned in #28 that setting |
That actually works really well with |
Did you check the docs and existing issues?
Neovim version (nvim -v)
NVIM v0.8.2
Operating system/version
ArchLinux
Describe the bug
I'm using buffer manager and if I open a file with Oil and open buffer manager menu, Oil buffer still appears in the list of buffers. But, if I wait about 5-10 seconds, Oil buffer closes itself (expected behavior).
Buffer manager shortens the path to a file, but oil buffer uses, if I understand correctly, a protocol
oil:///<path/to/a/file>
. And when I trigger buffer manager, it shortens oil buffer removing one slash, triggering second time will remove another slash which basically gives a buffer that does not exist.While it is probably a bug from a buffer manager side to shorten path to protocols, the oil's problem is not closing the buffer immediately after opening a file.
Steps To Reproduce
:Oil
:lua require("buffer_manager.ui").toggle_quick_menu()
-> buffer in the listExpected Behavior
The oil buffer closes right after opening a file.
Directory structure
No response
Repro
Did you check the bug with a clean config?
nvim -u repro.lua
using the repro.lua file above.The text was updated successfully, but these errors were encountered: