-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
Opening nvim-tree in a split breaks vinegar-style #2227
Comments
Replicated with defaults. Nothing specific to vinegar style. It's working as intended: the tree will open on the left/right depending on You can, however, override this behaviour using the newly added winid parameter for Try something like this: require("nvim-tree.api").tree.open({ winid = vim.api.nvim_get_current_win() }) |
We need some recipes for winid... |
Interesting, I'll give that a shot. I was also able to work around this issue by setting vim.api.nvim_create_autocmd({"BufEnter", "BufNewFile"}, {callback = function()
local buf = vim.api.nvim_get_current_buf()
local bufname = vim.api.nvim_buf_get_name(buf)
if vim.fn.isdirectory(bufname) ~= 1 then
return
end
lib.open {current_window = true, path = bufname}
end}) |
I've spent a bit of time looking at this today and I'm not sure I agree with this being correct behavior. Looking through To better understand what I'm talking about, try running the following commands with the default configuration:
The original buffer opened with I played around a little with loosening the above restriction, but it turned into a mess quickly. This is probably beyond my ability to fix in the time I have. I have a fairly close analogue to vinegar behavior at the moment provided I do not attempt to open more than one |
That is correct. nvim-tree does not properly handle multiple instances across tabs and the state of the tree is a singleton. There is much work to be done to isolate instances. See #457 Assistance implementing such features would be gratefully appreciated. Closing as this is not a bug and tracked elsewhere. |
Description
I've been scratching my head over this one this evening. I've been experimenting with using nvim-tree in vinegar mode and for the most part everything works as expected, however attempting to open nvim-tree from within a split breaks terribly. This can most easily be seen by editing a directory (eg.
:e .
) from within a split. The result is the split is closed, and the nvim-tree window is opened in a vertical split rather than replacing the buffer as expected.Neovim version
Operating system and version
macOS 12.5
nvim-tree version
b1e074d
Minimal config
The text was updated successfully, but these errors were encountered: