nvim-tree / nvim-tree.lua

A file explorer tree for neovim written in lua
Other
7.17k stars 609 forks source link

Not changing root directory to the one that contains the .git #230

Closed DimitrisMilonopoulos closed 2 years ago

DimitrisMilonopoulos commented 3 years ago

When opening a file from a git (ex. with startify) the explorer doesn't update its root directory to be the root of the project. Is there any way to achieve that?

Thank you for this great file explorer :)

kyazdani42 commented 3 years ago

thanks :) Hum it should follow nvim's root cwd. What happens when you type :pwd ?

ceuk commented 3 years ago

Happens for me too.

If you use :cd to set the cwd (confirmed with :pwd) and then open nvim-tree, it shows the whole home directory

Further, if you use <C-]> to set the cwd and then run something like :mksession! ~/.vim_session, restart nvim and source the session file, nvim-tree goes back to ~ even if you had explicitly set the working directory.

Using nvim nightly: v0.5.0-dev+950-g5ce328df4

kyazdani42 commented 3 years ago

indeed i did not subscribe to the DirChanged, this should be added as an option maybe

caheredia commented 3 years ago

Having the same issue. When opening a file from startify, I expect to be dropped into the project root directory, not my home directory.

kyazdani42 commented 3 years ago

i'll work on a path handling rewrite soon, i'll try and use different plugins / options to make sure the algorithm works as expected for every situations. In the meantime, please be patient :)

kyazdani42 commented 2 years ago

should have been working for some time now. closing