20

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?

1
  • Maybe cache? Try to type F5 in CtrlP window.
    – mattn
    Commented Jan 10, 2013 at 2:57

3 Answers 3

23

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 >>>

1
  • 4
    To set filename-search as your default search mode, add this to your vimrc: let g:ctrlp_by_filename = 1
    – jonS90
    Commented Jun 28, 2016 at 20:14
6

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .