Open showermat opened 1 year ago
Yes, this stands out:
set autochdir
That is causing your problem. If you use that, you'll want to disable neo-tree's bind_to_cwd
option.
Ah, okay. That wasn't fixing the problem for me, so I read the code -- which is probably what I should have done from the start. I found this snippet: if not is_in_path then return false end
.
So it looks like Neo-tree is designed to bail out and not follow if the file is outside the current root. Is there a way to get "universal" following -- something like the pseudocode, if is_in_path then [current behavior] else cwd(dirname(file.path)) end
?
@showermat I have tested with follow_current_file = true
and :set autochdir
, which seems to work well. Is this the desired behavior for you?
In my setup, that doesn't work as I expect. With :set autochdir
, follow_current_file = true
, and bind_to_cwd = false
as prescribed above, the view in Neo-tree does not change at all when I open a new file unless that file is already below the current top-level directory open in Neo-tree. As I mentioned in my previous comment, I think this is due to a mismatch in expectations of in what circumstances Neo-tree should follow the file.
Ah ok I see. I will have a look at how to implement this.
Hey @nhat-vo, is there any update on the issue? 🙂
I agree with it, Neo-tree windows should follow cwd of active tab, otherwise, when focus neo-tree windows, it will jump back to previous root. Thx. @nhat-vo
Ah, okay. That wasn't fixing the problem for me, so I read the code -- which is probably what I should have done from the start. I found this snippet:
if not is_in_path then return false end
.So it looks like Neo-tree is designed to bail out and not follow if the file is outside the current root. Is there a way to get "universal" following -- something like the pseudocode,
if is_in_path then [current behavior] else cwd(dirname(file.path)) end
?
Hi, thanks for this exciting plugin!
I'm running into weird behavior that's so obvious I'm sure I'm doing something wrong. With
follow_current_file = true
, the view in the Neo-tree sidebar follows the currently edited file as long as my cursor stays in the file window. Great! But the moment I switch focus to the Neo-tree window, Neo-tree jumps back to whatever directory it was in when I opened the sidebar. If I move focus back out of the Neo-tree window, it jumps back to the directory containing the file I'm editing.It feels like Neo-tree is displaying the working directory of the focused window but not changing its own window's working directory to match. I played with the values of
bind_to_cwd
andcwd_target
, but nothing seems to help. I do haveautochdir
set, but disabling it seems to break file following entirely. Here's a minimal config that reproduces the problem for me:Does anything stand out to you that could be causing this? Thanks!