-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Tree does not refresh after :bdelete. #3071
Comments
I'm not able to reproduce this; the window is closed on |
The three files in the video are all in the same folder and so nothing changes after :bdelete. Please try opening three files from different folders (entering the folders with C-]). The correct tree should (and does) display after :bprev / :bnext, but after :bdelete, the tree remains in the folder of the deleted file. |
Sorry, I'm still not understanding how this is reproduced; when I enter the folder It looks like you're not using the minimal configuration in your video. It's also not clear what the directory structure is; are their two mains? Please provide an exact reproducer with the minimal config above, showing the directory/file structure first e.g.: $ find .
.
./1
./1/bar
./nvt-min.lua
./3
./3/foo
./2
./2/baz
$ nvim -nu nvt-min.lua
|
Strangely, I can recreate the problem in the minimal config with my own file structure, but when I created a simple test directory (test) with three folders (1, 2, 3) each containing a single file (foo, bar, baz), then scrolling between them using :bnext didn't display the folder and file, but just displayed the full tree from test. |
I'm happy to attempt to replicate with your file structure; it sounds like there is a real issue here. Please don't hesitate to reopen if this becomes a problem in the future. |
Description
I like to work with the tree open all the time and with the root set to my desired folder. This all works fine. The only problem I have is when I close a buffer. I noticed that in this case, the tree does not update to match the file displayed, which is a little irritating.
Initially, I tried using a function to call :Bdelete and then :NvimTreeRefresh but this does not work. The tree shown matches the deleted file and not the one subsequently displayed in the buffer. Manually entering NvimTreeRefresh, or toggling the display, both correct the problem.
Bdelete is from a plugin and so I tried with :bdelete, followed by closing and opening nvim-tree. This works as individual commands, but not as a function.
Also, chaining the commands as :bd | NvimTreeClose | NvimTreeOpen doesn't work. The tree is again stuck on the path of the deleted buffer. Issuing the commands one at a time results in the correct path being displayed.
As a temporary workaround, I have a function that calls :Bdelete and then :NvimTreeClose. If I then manually open nvim-tree, the tree is shown correctly. This is the least worst option compared to manually refreshing the tree after closing the buffer, which feels very inelegant.
Neovim version
Operating system and version
macOS 15.3.1
Windows variant
No response
nvim-tree version
6709463
Clean room replication
Steps to reproduce
Expected behavior
When issuing :bdelete, tree updates to cwd of displayed file.
Actual behavior
Tree remains on cwd of file closed. This usually does not match the file displayed.
The text was updated successfully, but these errors were encountered: