Skip to content
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

Incorrect behavior when closing last buffer when NvimTree is open #9

Open
xyven1 opened this issue Apr 25, 2022 · 3 comments
Open

Incorrect behavior when closing last buffer when NvimTree is open #9

xyven1 opened this issue Apr 25, 2022 · 3 comments

Comments

@xyven1
Copy link

xyven1 commented Apr 25, 2022

When closing the last buffer with NvimTree open and preserve_window_layout on, close-buffers will also close the NvimTree buffer (but correctly preserve the windows), even though I have NvimTree in the ignore list.
This bug occurs when running :BDelete with this, all, etc (anything with preserve_window_layout on and that removes the last buffer)
Before running :BDelete this
image

After:
image

Correct behavior:
image

@xyven1
Copy link
Author

xyven1 commented Apr 25, 2022

I managed to partially fix the issue by filtering what windows to affect when preserving windows (line 53 buffers.lua):

local all_windows = vim.tbl_filter(function(win) 
  return api.nvim_buf_get_option(api.nvim_win_get_buf(win), 'buftype') ~= 'nofile'
end, api.nvim_list_wins())

Still some wonky behavior with NvimTree though

@towry
Copy link

towry commented Jun 10, 2022

Even worst if has split window:

截屏2022-06-10 15 44 57


Considering use another plugin, which works pretty well with nvim-tree.

https://github.com/ojroques/nvim-bufdel

Also set hijack_unnamed_buffer_when_opening = true in nvim-tree will reuse nameless buffer.

@xyven1
Copy link
Author

xyven1 commented Jun 10, 2022

Thanks for the tip. I will look into the other plugin, and I will definitely add the hijack option to nvim-tree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants