nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

Updating focused file under directory results in base cwd being changed

Open fgheng opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. Hello, I used

update_focused_file = {
    enable = true,
    update_cwd = true,
}

I am in project Pro, and this project has a file Pro/Dir/a.cpp When I open a.cpp, the 'cwd' changed to the directory Dir.

I think it should not change the work dir, because I am not leave the project dir, I just expand the project. and it would be good if change work dir only using action 'cd' and 'dir_up'.

fgheng avatar May 06 '22 14:05 fgheng

That is the intended functionality for update_focused_file.update_cwd.

update_cwd is the option you want: changes dir when you change the tree dir or vim's dir. See :help nvim-tree.update_cwd

alex-courtis avatar May 07 '22 00:05 alex-courtis

@alex-courtis seems like it's not, the file should be found and the the cwd should not be updated. It should update the cwd only if the file is not found under this cwd. Looks like a bug to me.

kyazdani42 avatar May 07 '22 09:05 kyazdani42

Looks like a bug that i cannot reproduce. @fgheng would you be so kind to share a minimal config ?

kyazdani42 avatar May 07 '22 09:05 kyazdani42

Closing due to inactivity.

alex-courtis avatar Sep 03 '22 03:09 alex-courtis