I'm using neotree and projectile. I can open neotree at my project root using neotree-find-project-root, and it's beautiful.
When I open a file in a subfolder, it changes the neotree root to the folder that contains that file. This is less useful to me than if neotree view remained the project root.
Can I force neotree to always display the project root folder, and not automatically descend into subfolders?
(Toggling neotree off and on again using neotree-find-project-root will bring it back to the root, but it's a pain to do this manually. There must be a way to automatically do this?)
I don't see a way to configure neotree to do this. You could consider submitting an issue to the developers of neotree, as this seems like it would be a common feature request.
As a sort of hacky fix, you could try something like this.
(add-hook 'find-file-hook
(lambda ()
(let ((buffer (current-buffer)))
(neotree-find (projectile-project-root))
(set-buffer buffer))))
This hook is run every time a new file is opened. It changes the neotree directory to the projectile project root, then sets the current buffer to the original buffer you were working with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With