Hacker News new | ask | show | jobs
by michael_michael 5158 days ago
As a quick and dirty test I tried running both Command-T and Ctrl-P against a directory tree containing some 26,000 XML files. Command-T takes roughly 10-15 seconds to become responsive. Ctrl-P chokes and requires a Vim restart after invoking it against this directory.
3 comments

That should be a fairly trivial fix in both of them.

Simply abort the scanning after a configurable threshold (either seconds or files).

Needless to say that, yes, this must be implemented.

I've choked my vim more than once by accidentally running Command-T or FuzzyFinder in the "wrong" directory. That should not happen.

Command-T definitely has the feature you're talking about (CommandTMaxFiles I think.) I'm not sure about CtrlP.
If you are on Unix, add this to your vimrc and the directory indexing speed should go through the roof:

https://gist.github.com/ee14d6ecb9196a07da56

Is that offloading the task of scanning file names to the find command?
Looks like find is piped into head, though. So it would only index the first ten?
No, it's the first g:ctrlp_max_files which is defined as 10000
Oh, true. Good call.
Is there a reason that Ctrl-P, FuzzyFinder, and Command-T choke on large directories? On windows, I've used this piece of software called Everything Search that seems to index the entire filesystem (say around 30,000 files) in under 5 seconds. That's really impressive and I love using it for that.

But it makes me sad to use these vim extensions choking on directories of similar size. Maybe NTFS vs ext4 has something to do with it?