airblade / vim-rooter

Changes Vim working directory to project root.
MIT License
1.23k stars 72 forks source link

rooter_patterns child directories not working as expected #138

Open cdalsass opened 5 months ago

cdalsass commented 5 months ago

In g_rooters, I notice that

'>/Users/charlie/dev/'

Where I'd like to match the folder /Users/charlie/dev/project1, /Users/charlie/dev/project2 etc.

Does not work properly.

Looks like an easy fix, and will provide a PR - assuming I'm understanding the configuration properly.

Is anyone else seeing this?

airblade commented 5 months ago

What do you mean by not working properly? Please provide repro steps.

cdalsass commented 5 months ago

Configure vim as follows:

let g:rooter_patterns = ['>/Users/chucky/projects' ]

Setup a few projects.

 mkdir -p /Users/chucky/projects/project1
 mkdir -p /Users/chucky/projects/project2
 echo "test" > /Users/chucky/projects/project1/test.txt
 echo "test" > /Users/chucky/projects/project2/test.txt

open vim and edit project1/test.txt. Type ":pwd". Plugin doesn't switch to /Users/chucky/projects/project1/, as expected. Similarly, edit project2/test.txt. Does not correctly switch to project2.

NVIM v0.9.0 https://github.com/airblade/vim-rooter.git version 1353fa47ee3a81083c284e28ff4f7d92655d7c9e

cdalsass commented 5 months ago

@airblade let me know if my understanding is correct. Also, it would be great to refresh NerdTree when switching projects, as I've missed the console a few times and been confused. (I can include that too).

airblade commented 5 months ago

Thank you for the example – it's much easier to debug something concrete.

And your understanding of the pattern '>/some/dir' is correct.

Plugin doesn't switch to /Users/chucky/projects/project1/ ... Does not correctly switch to project2.

It does for me.

I wonder what differs between your setup and mine? You mentioned NerdTree; if you uninstall that, does your example start behaving as expected?

cdalsass commented 3 months ago

Even after uninstall of Nerdtree, the issue is there. Switching back to my branch does resolve it.