Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've tried FuzzyFinder, +T, and Ctrl+P (which is my finder of choice right now), but none hold a candle to Sublime Text 2. For example, I want to type:

Head.php

and have it find, among others:

app/code/core/Mage/Page/Block/Html/Head.php

Currently in Ctrl+P, which has otherwise served me better than +T, searching for Head.php gives me these first:

downloader/lib/Mage/Connect/Command/Config_Header.php
app/code/local/Namespace/Modals/Helper/Reader.php
app/code/core/Mage/XMLConnect/Helper/Ipad.php

My file is nowhere to be found (and I've never opened any of the above files), so I have to type this instead:

pagehtmlhead.php

Is there any utility that does smarter scoring/matching?

share|improve this question
    
There are many alternatives. Did you try all of them? –  romainl Nov 2 '12 at 10:18

1 Answer 1

You are using "full-path search". The characters you type are matched against every item in the whole path.

Typing this:

amuse

would match:

[a]pp/[m]odels/[use]rmanager.php

What you need is "filename search" which matches only against the last part of the path: the "filename".

Typing this:

use (or maybe even us or u, depending on your usage patterns)

would match:

app/models/[use]rmanager.php

Both methods fit different usage patterns. "Full path" may be useful in situations where you don't really know the layout of the project (or the opposite: when you have a precise mental map) because it allows you to drill down incrementally:

[a]pp/*[a]pp/[m]odels/*[a]pp/[m]odels/[use]*

"Filename" can be faster when you don't want to think too much about the structure of your project or when it is so small that you can be fairly certain that there's only one usermanager.php.

To toggle the search method at the prompt, hit <C-d>: the prompt looks like >>> in "full-path search" and >d> id "filename search".

To use "filename search" by default, just add this line to your ~/.vimrc:

let g:ctrlp_by_filename = 1

Also, you type too much: from my experience, he, or maybe hea would probably be enough.

If the file doesn't appear, you might want to hit <F5> to refresh the cache.

More generally, it's in your interest to read the documentation of the plugins you install.

share|improve this answer
    
Thank you, this helps with my particular case – and it's true that reading docs gives your answer, but a few things: 1) he or hea is not always enough. maybe in filename mode with just a few files that start with hea. when you have many such files, faster to be specific than to review and navigate results; 2) i did not try every plugin in the db, only the 3 most popular, hoping that 1 would approximate sublime's smart matching (and scoring, which ctrl-p does not do). I asked here b/c I thought 1 person could spend 3 minutes to save me hours of trying plugins that don't claim to do what I need. –  Jed Nov 2 '12 at 13:06
    
Also, you'll note that typing a more specific path found my file, so refreshing was obviously not the issue. I don't know how you can even start to use ctrl-p without knowing how to refresh. But then maybe that's how you feel about filename mode. Regardless, I was really hoping someone would have a plugin that scores based on frequency of access, recency of modification, etc. on top of path/name. Yes, I know there is mru mode and such but just not as sophisticated or slick as Sublime. –  Jed Nov 2 '12 at 13:11
    
"sophisticated" and "slick" are too subjective: I find ST2's system dumb and limited. I've been using CtrlP since it was released and LustyExplorer before. With both plugins, I never have to type more than 3 or 4 characters to reach my destination. Did you try the ; trick to refine your search? Also, fuzzy search works best when it deals with entities with different names: whatever you do, the engine can't really tell from hea if you want head, heads, heart or heat… FWIW, CtrlP does a fine job sorting hits by proximity and frequency. –  romainl Nov 2 '12 at 15:35
    
I usually work on rather small projects (less than 50 source files). Just now I tried ctrlp on a larger project (robotlegs) and it was absolutely unable to find some files 4 or 5 directories deep. –  romainl Nov 2 '12 at 16:23
    
Yes, maybe the issue is primarily on projects with 1000s of source files. The one that compelled this post is 11000+ (excluding files/directories I've ignored). Even at that size, ST2 finds what I'm looking for quickly and efficiently. CtrlP not only does a poorer job, but for every character I delete in my CtrlP query, it takes about 1.5 seconds to update results. Not the case typing forward, so if I mis-key or want to try a few different characters it's much more efficient to delete a whole word (or path) with <c-w> and type forward. Not great. Thanks for your continued thoughts, though! –  Jed Nov 3 '12 at 15:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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