chadtree
chadtree copied to clipboard
Honor `getcwd()`
First, awesome plugin. Thanks for all the work.
I am looking for a NERDTree alternative, and your plugin is pretty awesome. However, an issue I am having is with what directory does the CHADopen opens in.
I have this mapping to show as an example:
nnoremap <plug>file_browser :NERDTreeToggle <c-r>=getcwd()<cr><cr>
So let's say I have 2 windows split, but with files in completely different folders. CHADopen recognizes the folder change if both splits show files in the same root directory. But if one of the windows changes to a different root folder, let's say a different git repo it does not notices the change.
Hopefully this not too confusing :smile:
sorry im not quite sure what you mean, as far as i know vim does not allow multiple cwds,
CHADTree basically just changes root whenever vim changes its own cwd, which i think is logical,
can you please explain more, what do you propose that I need to add?
Sorry for the late response. I've recorded to screen cast below, trying to illustrate the issue, the first one shows nerdtree behavior, the second shows chadtree behavior. Hopefully this makes things clearer.
Again the issue is that in a split screen with buffer with different root directories, chadtree opens from both buffers in the same directory.
https://github.com/ms-jpq/chadtree/issues/77
Sorry, I still don't know what exactly you want, would adding in the above feature fix it for you?
each window can have its own cwd. see :h lcd. Basically when you switch to a window (IMHO) the tree should adjust to the window-local cwd. It kind of does this, but then when you jump back to the tree, it goes back to the global cwd. it's a weird behavior. It becomes unusable when you use (as I do) vim-rooter with let g:rooter_cd_cmd = 'lcd'
@jdelkins Thanks for the comments. But I still don't understand why wouldnt this be the behavior. If I have a split, there should be an option that when I toggle chadtree it uses lcd. Then if I go to another split that goes to a completely different tree (but still same window), and I toggle again, it should again honor lcd. I don't mean to be rude, this your project @ms-jpq, if you feel that is just something that doesn't make sense, feel free to close the issue. Great plugin once again!
nono you are not rude at all, i had no idea lcd was a thing in the first place.
I am coming around to add this, kind of slow because I am feeling ill the past few days due to an infection after surgery
@tricktux i was agreeing with your suggestion, trying to provide @ms-jpq some background about how I (and I think you also) think it could work better.
Sorry to hear that @ms-jpq! Safe recovery! What better way than hacking away right?! :wink: