Fuzzy Finder vs CtrlP

2,605 views
Skip to first unread message

Chris Lott

unread,
Feb 4, 2012, 7:34:36 PM2/4/12
to vim...@googlegroups.com
Has anyone used Fuzzy Finder and CTRLP enough to have thoughts on
which one might be preferable? They seem quite similar, but I might be
missing something that will come back to haunt me later :)

c
--
Chris Lott <ch...@chrislott.org>

Jeroen Budts

unread,
Feb 5, 2012, 6:39:13 AM2/5/12
to vim...@googlegroups.com, Chris Lott
On 02/05/2012 01:34 AM, Chris Lott wrote:
> Has anyone used Fuzzy Finder and CTRLP enough to have thoughts on
> which one might be preferable? They seem quite similar, but I might be
> missing something that will come back to haunt me later :)

I used FuzzyFinder over a year ago and am now using CtrlP. I also used
Command-t in between. Of those 3 plugins, CtrlP is IMHO by far the best,
although command-t is also nice.
I found FuzzyFinder to be rather slow and have some strange behaviour
from time to time. Command-t is fast, because it uses a small external
application (written in C I believe) to scan for files. CtrlP is also
very fast, because it caches the file list. CtrlP is entirely written in
Vimscript, and that is one of the advantages over Command-T. I can use
CtrlP without any problem on my Nokia N900, while command-t is a lot
more difficult because of it's dependencies on Ruby and a C compiler.
Also CtrlP has more features. It can scan files in the current
directory, from the root of your repository (if using Git for example),
it can scan open buffers, most recently used files, tags etc. With ctrlp
you can also create files and open multiple files at once.

Hope this helps,
Jeroen


--
website: http://budts.be/ - twitter: @teranex
___________________________________
Registered Linux User #482240 - GetFirefox.com - ubuntu.com

Michael Ludwig

unread,
Feb 5, 2012, 4:52:31 PM2/5/12
to vim...@googlegroups.com
Jeroen Budts schrieb am 05.02.2012 um 12:39 (+0100):

> Also CtrlP has more features. It can scan files in the current
> directory, from the root of your repository (if using Git for

> example) […]

Just discoved CtrlP through your message. Looks just great. Does
anyone happen to know how I can make it ignore files und my Mercurial
directory ( .hg ) as I sure don't want to edit those? (Sorry for the
hijack.)

Michael

Michael Ludwig

unread,
Feb 5, 2012, 4:57:47 PM2/5/12
to vim...@googlegroups.com
Michael Ludwig schrieb am 05.02.2012 um 22:52 (+0100):

> Does anyone happen to know how I can make it ignore files und my
> Mercurial directory ( .hg ) as I sure don't want to edit those?

Haha, found it! Documented in the fine manual:

:set wildignore+=*/.hg/*

What a great Vim extension! Sorry for the distraction …

Michael

Michael Ludwig

unread,
Feb 5, 2012, 6:03:36 PM2/5/12
to vim...@googlegroups.com
Michael Ludwig schrieb am 05.02.2012 um 22:57 (+0100):

> What a great Vim extension!

[Re: Fuzzy Finder vs CtrlP]

What would you use if you didn't need or want the fuzziness of the
matching because you found exact matching on filenames or directory
names more useful?

I've read the CtrlP manual, and while there are many options to
configure things there does not see to be one to switch from fuzzy
to exact matching.

Michael

Jeroen Budts

unread,
Feb 5, 2012, 6:18:21 PM2/5/12
to vim...@googlegroups.com
As far as I know there is no exact matching. There is however
regex-matching, which does nearly the same. If you enable regex
matching, for example by pressing ctrl-r while the ctrlp window is open,
you can just start typing and it will only give you exact matches,
unless ofcourse, you use special 'regex-characters'. However, I found
that it can become rather slow on large trees.

Michael Ludwig

unread,
Feb 5, 2012, 6:33:38 PM2/5/12
to vim...@googlegroups.com
Jeroen Budts schrieb am 06.02.2012 um 00:18 (+0100):
> On 02/06/2012 12:03 AM, Michael Ludwig wrote:
> >
> >What would you use if you didn't need or want the fuzziness of the
> >matching because you found exact matching on filenames or directory
> >names more useful?

> As far as I know there is no exact matching. There is however


> regex-matching, which does nearly the same. If you enable regex
> matching, for example by pressing ctrl-r while the ctrlp window is
> open, you can just start typing and it will only give you exact
> matches, unless ofcourse, you use special 'regex-characters'.
> However, I found that it can become rather slow on large trees.

Thanks, Jeroen. That's a significant improvement over fuzzy matching.
I agree with your observation on speed. Consider that exact substring
matching should be at least as fast as fuzzy matching. I really wonder
why this is not an option yet. If you type "gcc" and CtrlP comes up
with a suggestion of "kochen\MangoldSchinkenCannelloni.html", it might
be funny and wet your appetite but it's not what you were looking for.

Michael

Tim Gray

unread,
Feb 5, 2012, 7:45:04 PM2/5/12
to vim...@googlegroups.com
On Feb 05, 2012 at 10:52 PM +0100, Michael Ludwig wrote:
>Just discoved CtrlP through your message. Looks just great.

Me too. I'm not sure if I'll end up using it over Command-T (or
Peepopen), but I am going to play around with it and see how it goes.

Michael Ludwig

unread,
Feb 5, 2012, 8:53:11 PM2/5/12
to vim...@googlegroups.com
Michael Ludwig schrieb am 06.02.2012 um 00:33 (+0100):

> I really wonder why [exact substring matching] is not an option yet.

It is easy to make it one. In file autoload/ctrlp.vim, locate the
s:SplitPattern(str) function and shortcut the code that translates
the user input into an all-too liberal pattern that will give you
"MangoldSchinkenCannelloni" if you ask for just "gcc":

diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim
index 2730172..e46288e 100644
--- a/autoload/ctrlp.vim
+++ b/autoload/ctrlp.vim
@@ -327,6 +327,10 @@ fu! s:SplitPattern(str) "{{{1
if s:regexp || match(str, '\\\(<\|>\)\|[*|]') >= 0
let pat = s:regexfilter(str)
el
+ " Milu: ...
+ " ...
+ " "gcc" die "MangoldSchinkenCannelloni" liefert.
+ return str
let lst = split(str, '\zs')
if exists('+ssl') && !&ssl
cal map(lst, 'escape(v:val, ''\'')')

Michael

pansz

unread,
Feb 5, 2012, 8:54:21 PM2/5/12
to vim...@googlegroups.com
On Sun, Feb 5, 2012 at 8:34 AM, Chris Lott <ch...@chrislott.org> wrote:
> Has anyone used Fuzzy Finder and CTRLP enough to have thoughts on
> which one might be preferable? They seem quite similar, but I might be
> missing something that will come back to haunt me later :)

In Oct. 2011, I've tried FuzzyFinder, CtrlP, CtrlT, Peepopen and
several other plaugins and found FuzzyFinder suits me best. YMMV.

Well, CtrlP released its first version in Oct. 2011. So, things might
have changed, and CtrlP may be a true competitor or even surpass
fuzzyfinder now.

Michael Ludwig

unread,
Feb 5, 2012, 8:56:22 PM2/5/12
to vim...@googlegroups.com

It seems this fuzzy matching is part of a new-fuzzled definition of
usability. Here's an excerpt from the Command-T homepage:

To search efficiently, especially in large projects, you should
adopt a "path-centric" rather than a "filename-centric" mentality.
That is you should think more about where the desired file is
found rather than what it is called. This means narrowing your
search down by including some characters from the upper path
components rather than just entering characters from the filename
itself. -- https://github.com/wincent/Command-T

Does that work well for you? Maybe for project where all files have the
same names because some framework favors Convention Over Configuration?

I guess most humans find it easier to remember words or part of words
instead of "some characters from the upper path components".

Michael

Michael Ludwig

unread,
Feb 5, 2012, 9:13:56 PM2/5/12
to vim...@googlegroups.com
Michael Ludwig schrieb am 06.02.2012 um 02:56 (+0100):

> Here's an excerpt from the Command-T homepage:
>
> To search efficiently, especially in large projects, you should
> adopt a "path-centric" rather than a "filename-centric" mentality.
> That is you should think more about where the desired file is
> found rather than what it is called. This means narrowing your
> search down by including some characters from the upper path
> components rather than just entering characters from the filename
> itself. -- https://github.com/wincent/Command-T
>
> Does that work well for you? Maybe for project where all files have the
> same names because some framework favors Convention Over Configuration?

The screencast "Live demonstration" from [1] confirms this suspicion.

[1] https://wincent.com/products/command-t

CtrlP and Command-T seem close in terms of functionality. One point in
favour of CtrlP: It's in VimL where Command-T is in Ruby.

Michael

Tim Gray

unread,
Feb 5, 2012, 9:22:35 PM2/5/12
to vim...@googlegroups.com
On Feb 06, 2012 at 02:56 AM +0100, Michael Ludwig wrote:
>Does that work well for you? Maybe for project where all files have the
>same names because some framework favors Convention Over Configuration?

It works pretty well. If you remember the file name, or parts of it,
and you type it in, it will find it pretty quick. If you have multiple
files with the same (or similar names), like a bunch of 'index.html'
files, you'll obviously have to type in some of the parent directory
names to narrow down your search.

But, if you only have one file named 'file.txt' and you type in
'filetxt', it will be the suggested file, even if it's many levels deep.

pansz

unread,
Feb 5, 2012, 10:31:49 PM2/5/12
to vim...@googlegroups.com
Ctrl-P works well only when project root found. i.e. when you are
editing from .hg, .svn, .git repositories.

When Ctrl-P starts in a non-SCM-controled directory, it starts very
slow (because it tries to read all files). For example, try cd /etc
and then use vim ctrlp...

If you do never start vim outside your project, Ctrl-P is better than
fuzzyfinder.

On Sun, Feb 5, 2012 at 8:34 AM, Chris Lott <ch...@chrislott.org> wrote:

Michael Ludwig

unread,
Feb 6, 2012, 4:57:14 PM2/6/12
to vim...@googlegroups.com
pansz schrieb am 06.02.2012 um 11:31 (+0800):
> Ctrl-P works well only when project root found. i.e. when you are
> editing from .hg, .svn, .git repositories.
>
> When Ctrl-P starts in a non-SCM-controled directory, it starts very
> slow (because it tries to read all files). For example, try cd /etc
> and then use vim ctrlp...

It should measure the depth of the sea before attempting to dive to the
bottom. There are some options giving you control, though:

The maximum number of files to scan, set to 0 for no limit:
let g:ctrlp_max_files = 10000

The maximum depth of a directory tree to recurse into:
let g:ctrlp_max_depth = 40

Specify an external tool to use for listing files instead of using
Vim’s |globpath()|. Use %s in place of the target directory:
let g:ctrlp_user_command = ''

:help 'ctrlp'
--
Michael

Reply all
Reply to author
Forward
0 new messages