Closed ienapliss closed 6 months ago
This is due to an autocmd in aerial that quits when it is the last window open. The intent was that if someone opens a file, then opens aerial, then :quit
, we want to exit Neovim instead of closing the main buffer window and leaving up a full-screen empty aerial window.
The reason for the behavior you're seeing is that :bdelete
behaves in two different ways. If you call :bdelete
with only one listed buffer, it will delete the buffer and open a new empty buffer in the current window (thus, no issues). However, if you have multiple listed buffers and run :bdelete
, it deletes the buffer and closes the window. This was triggering the aerial "quit" logic.
I've updated the autocmd to try to only manually quit Neovim if the previous command issued was one that would exit Neovim.
Neovim version (nvim -v)
v0.9.4
Operating system/version
Windows 11, mingw-64 neovim
Output of :AerialInfo
Filetype: cpp lsp: attached treesitter: supported
Describe the bug
If an Aerial buffer is present while working from another buffer, calling :bdelete will crash or quit nvim instead of just closing the buffer.
If I call :bdelete from inside the Aerial buffer, it close Aerial as expected.
But if I return on my other buffer and call :bdelete from there (Aerial buffer inactive) either nvim will crash or simply quit (hard to tell) instead of closing the buffer and remain open as expected.
If I toggle Aerial off with the same ":AerialToggle! left" then I can :bdelete the buffer as expected. So this bug happen when Aerial is open but in an inactive buffer. Also, when I open another unrelated buffer, I can still close the buffer without problem. Only the buffer in which I toggle Aerial from is affected.
Right now the only workaround is to append :AerialCloseAll before calling :bdelete.
Important Update: apparently the bug is not always triggered when a single buffer is opened. But opening two or more buffers seems to always reproduce it 100% of the time.
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
Open more than 1 files. Open Aerial with ":AerialToggle! left" Change to another buffer (not Aerial). Call ":bdelete".
Expected Behavior
:bdelete command should simply close the buffer. But it will crash or quit nvim instead.
Minimal example file
No response
Minimal init.lua
Additional context
This bug was previously reported but it was closed without any resolution: "https://github.com/stevearc/aerial.nvim/issues/284"