3

The main project I work on is split up into multiple git projects. I'd like to be able to Ctrl-P search for files in a different project than the one I'm currently in, but as far as I can tell, I can't make Ctrl-P search anything other than the current git project (since it stops when it finds the .git ancestor).

Is there a way to tell Ctrl-P to search in multiple .git projects?

5

There are a few options depending on the layout of directories.

If all these repos are contained in a single root folder that you want to search, then you can search that directory explicitly by running :CtrlP myproject. Alternatively, I believe you could say let g:ctrlp_root_markers=['.root'] and make a .root file in the root (myproject) directory.

If for some strange reason you can't put all these directories in one root, you could make a directory somewhere else, put symlinks in it to all the directories you want searched, put let g:ctrlp_follow_symlinks=1 in your .vimrc, and explicitly tell CtrlP to use this directory when running (:CtrlP mynewroot).

Failing that, you could modify ctrlp_user_command, but doing so gets complicated and will ignore other ctrlp settings.

  • Thanks :CtrlP myproject was what I needed. Note to anyone else looking at this, myproject is the path to the directory that you want to use as your parent. – kash Mar 25 '15 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.