Ctrlp currently searches/indexes my entire home directory, how can I tell it to only index ~/code?
How to white list a directory for ctrlp in vim
295 Views Asked by hermancain At
2
There are 2 best solutions below
0
On
CtrlP searches/indexes your entire home directory because that's what you ask it to do.
You are probably starting Vim in your $HOME and doing :CtrlP from there. Since the working directory is $HOME you shouldn't be surprised that CtrlP scans all of it.
The solution to this non-issue is simply to use your shell and Vim as they are supposed to be used:
$ cd ~/code
$ vim
You have several options to configure where CtrlP will search for files. You will have to add these to your
.vimrcfile.For example, in my case I use
agto perform the search:Normally CtrlP will look into the directory of the current project. If you always want to search in
~/codelike you ask, you could add this custom command (in OSX):You could even add extra directories, like:
However, I advise to not fix the directory where CtrlP will look and leave it to search for the project of the current file (see
let g:ctrlp_working_path_mode)