18

I was hoping that I could just type "job.php" and be directed to the job.php in my /lib/model/ folder, but I've mostly just get many other files returned:

[No name]

> batch/dataFixes/jobProspectsSubscriptionId.php
> batch/dataFixes/jobProspectsRankDistance.php
> batch/dataFixes/hiredJobDistanceRankFeedback.php
> batch/sendWeeklyJobOwnersUpdateEmail.php
> batch/dataFixes/backdateJobClosureDailyStats.php
> batch/dataFixes/jobExpectedRevenue.php
> batch/dataFixes/updateJobStats.php
> batch/updateEndedJobState.php
> batch/findUnresponsiveJobPosters.php
> batch/_job_criteria.php

 prt  file  <mru>={ files }=<buf> <->      /Users/shane/Documents/sites/zinc 
>d> job.php_

Switching to 'find in path' mode, and typing lib/model/job.php brings up tonnes of other classes in that folder which have 'job' in the filename, but not job.php.

Job is a pretty common word in our project, but I was hoping that an exact match for the filename would get ranked pretty highly in the results.

Am I using CtrlP wrong, or is the project not really suited to it?

  • Maybe cache? Try to type F5 in CtrlP window. – mattn Jan 10 '13 at 2:57
21

Easiest way is to toggle to file name only mode and regex mode, from docs:

Once inside the prompt:

Ctrl+D:
Toggle between full-path search and filename only search.
Note: in filename mode, the prompt's base is >d> instead of >>>

Ctrl+R:
Toggle between the string mode and full regexp mode.
Note: in full regexp mode, the prompt's base is r>> instead of >>>

  • 2
    To set filename-search as your default search mode, add this to your vimrc: let g:ctrlp_by_filename = 1 – jonS90 Jun 28 '16 at 20:14
5

Add the following to your ~/.vimrc (you may need to create if it does not exist):

let g:ctrlp_regexp = 1
2

I actually use CtrlP C matching extension ctrlp-cmatcher

Its quite a bit faster, and results are what one would expect (without having to use regex).

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.