Closed gfairchild closed 7 years ago
Hmm, the simplest thing I can think of would be to find the first .git
directory, which is usually at the project root of most projects. I typically avoid this by always opening vim from the root folder, and using Ctrl-P to find the file I want.
I think I could add an option to search for the first file that matches a certain pattern and consider that the search root. It would default to .git
, but could be anything. Would that solve the problem?
That sounds like a totally reasonable way to solve this. I like defaulting to .git
if it exists in the directory hierarchy. Looking more closely at the ctrlp.vim docs, that's basically what it does. See the second bullet point under https://github.com/ctrlpvim/ctrlp.vim#basic-options for more information.
Great, I'll come up with something similar, but probably a little simpler. Thanks for the link.
Great! Thanks very much for the quick response. I'm loving the plugin. The results seem better than ctrlp.vim, and it's almost instantaneous.
You can use the following to get the root for a git and mercurial repo. I do not use hg myself, but a quick search came up with this
$ git rev-parse --show-toplevel
$ hg root
note that the git solution stays within a submodule if it's called in one, but there are several ways to detect that
Oh that's pretty easy. Will see if I can get that in tonight.
Just wanted to check in on this issue to see what the status is. Thanks!
Indeed, I've been pushing this back a little because I wasn't sure how I wanted to go about it, but I have an idea now I'm going to try out!
I've implemented this behaviour in b5e9e1d1a64b8e8c3b3f49849c5570e67b952546 (master as of now), check it out and let me know if there are any issues.
Currently it defaults to the git or hg root if there is one.
This is fantastic! It seems to be working perfectly. Thanks man! This is so much faster than CTRL+P.
Awesome. I'll close this, feel free to open a new issue if you encounter any bugs.
Right now, this plugin seems to only find files within
pwd
. I write a lot of Django projects that have a structure like this:If I cd into
apps/app1
and open a file for editing, I can't hit CTRL+P to find/openbase.html
, for example, becausebase.html
doesn't live underapps/app1
. ctrlp.vim searches for all files within the project root by default (I guess it detects all files within the current Python environment?). Is there a way for this plugin to do the same?