i now upgraded my nvim-tree and realized it's broken with stickybuf if one nvim-tree option is active.
I'm guessing it's unfixable from stickybuf, but I guess at least we should add a message in the readme to warn users about that.
The nvim-tree feature in question is highlight_opened_files. When that option is activated, nvim-tree will highlight in the treeview files for which there is an open buffer in neovim.
Unfortunately, so that it removes the highlighting when you close such a file, it registers an autocmd tied to BufUnload against any buffer in neovim (not only buffers it owns):
https://github.com/nvim-tree/nvim-tree.lua/blob/c763861afb32f839555f9e797f4392f54ef4ad23/lua/nvim-tree.lua#L234
In the callback, it notes the buffer number that was closed and triggers a refresh of the treeview, removing the highlight for that buffer number. Unfortunately, when stickybuf is operating, it will get the buffer number wrong at the very least, but in my case it triggers some chain reaction that I don't fully understand and the outcome is that when I start neovim and open the first file, I'm in insert mode in that file instead of normal mode.
And if I disable the nvim-tree highlight_opened_files option, or uninstall stickybuf, the issue goes away. Note that disabling the nvim-tree support in stickybuf is not enough, because as I said it's not about the nvim-tree buffers, it's about any buffer being unloaded in the entire neovim app.
So yes.. Unless you can think of a trick to fix that, I guess we'd need to warn that running nvim-tree in that configuration is unsupported. It's a shame but...
i now upgraded my nvim-tree and realized it's broken with stickybuf if one nvim-tree option is active.
I'm guessing it's unfixable from stickybuf, but I guess at least we should add a message in the readme to warn users about that.
The nvim-tree feature in question is
highlight_opened_files. When that option is activated, nvim-tree will highlight in the treeview files for which there is an open buffer in neovim.Unfortunately, so that it removes the highlighting when you close such a file, it registers an autocmd tied to
BufUnloadagainst any buffer in neovim (not only buffers it owns):https://github.com/nvim-tree/nvim-tree.lua/blob/c763861afb32f839555f9e797f4392f54ef4ad23/lua/nvim-tree.lua#L234
In the callback, it notes the buffer number that was closed and triggers a refresh of the treeview, removing the highlight for that buffer number. Unfortunately, when stickybuf is operating, it will get the buffer number wrong at the very least, but in my case it triggers some chain reaction that I don't fully understand and the outcome is that when I start neovim and open the first file, I'm in insert mode in that file instead of normal mode.
And if I disable the nvim-tree
highlight_opened_filesoption, or uninstall stickybuf, the issue goes away. Note that disabling the nvim-tree support in stickybuf is not enough, because as I said it's not about the nvim-tree buffers, it's about any buffer being unloaded in the entire neovim app.So yes.. Unless you can think of a trick to fix that, I guess we'd need to warn that running nvim-tree in that configuration is unsupported. It's a shame but...