-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
A newly written file cannot be found with NERDTreeFind #779
Comments
Making a note here that several issues may be possible duplicates of this issue... no time to look into it right now. |
I have the problem in my fork, but you can't just force a refresh because it might be very slow for some directory trees. |
There are a few things that need to be dealt with here:
I'm doing some work on this right now... |
The ":NERDTreeFind" command calls the "reveal()" method on the NERDTree root node. The "reveal()" method would, in turn, call the node's "open()" method. Since the "open()" method would only initialize the child nodes of the root (i.e., read them from disk) when the list of child nodes was empty, new paths would not be included in the list. This commit will result in the refreshing of the child node list whenever "reveal()" is called on a directory node (unless it is the first time the node is being opened... the most efficient option). The result is that ":NERDTreeFind" will discover newly created paths that exist on disk but are not cached in the NERDTree. A stray debugging message is also removed. Fixes issue preservim#779.
For some reason this didn't get closed... Closing now. |
This seems to be working now too. |
When was the actual fix introduced? |
My understanding is that #794 removed the whole fix for this. |
I don't know what happened in the last two days. Maybe nothing. Maybe I was testing something else. I was sure it was working, but now, when I follow the steps in the original issue, I see the following error:
@juanibiapina, @lifecrisis, Is that what you're seeing? |
@PhilRunninger, the fix was removed. I don't remember the reason, but I remember thinking it was a good idea at the time... so this is still broken, unfortunately. |
This is how I fixed it on my fork: https://github.com/juanibiapina/vim-lighttree/blob/edd2da237f615441012679f47c371494966dafa1/autoload/lighttree.vim#L46 I just refresh the whole tree if the node cannot be found. For me that's a good trade off between speed and correctness, because the refresh only happens if the node cannot be found. The code there has diverged considerably, but a similar fix should be possible here. |
With a new created file that is not yet on the NERDTree node. When invoking NerdTreeFind on that file it will raise an error because of that file not being located in node nerdtree. This issue was raised in NERDTree repo but still not fixed. This is a temporary fix since it just mitigates the error by refreshing the node. preservim/nerdtree#779
This still happens to me when, for example, using :NERDTreeFind with vim-startify. A workaround is to use |
To replicate:
:w test.txt
.:NERDTreeFind
.Looks like a refresh is needed before
:NERDTreeFind
is run.The text was updated successfully, but these errors were encountered: