Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Add variables for the different options. See README.

  • Loading branch information...
1 parent 8641b06 commit 5b47120d2adfe7acf58134a047b9b62c96455a7a @jamis committed
Showing with 39 additions and 2 deletions.
  1. +6 −0 README
  2. +33 −2 fuzzyfinder_textmate.vim
@@ -13,6 +13,12 @@ Usage is almost identical to the Fuzzyfinder script, so you should check out the
Once in TextMate mode, completion is done against the entire directory tree at once, using partial matches. Results are sorted by "score", which is a measure of how closely the file matches the text you entered.
+There are several different variables that you may set in your .vimrc file that can be used to tweak the finder's behavior:
+* g:fuzzy_roots - this defaults to the current directory, but may be set to an array of paths that you want the finder to search.
+* g:fuzzy_ceiling - this defaults to 10,000, and is the maximum number of files that the finder will scan before it raises an error. To use the finder on larger trees, set this variable to a value larger than the number of files you expect to scan.
+* g:fuzzy_ignore - this is a semi-colon delimited list of file glob patterns to ignore.
+* g:fuzzy_match_limit - this is the maximum number of items that will be matched, and defaults to 200. If the finder feels sluggish to you, you can reduce this to something smaller (100, or 50).
35 fuzzyfinder_textmate.vim
@@ -54,7 +54,27 @@ RUBY
let g:fuzzy_ceiling = 10000
- ruby def finder; @finder ||="g:fuzzy_roots").split("\n"), VIM.evaluate("g:fuzzy_ceiling").to_i); end
+ " Configuration option: g:fuzzy_ignore
+ " A semi-colon delimited list of file glob patterns to ignore
+ if !exists('g:fuzzy_ignore')
+ let g:fuzzy_ignore = ""
+ endif
+ " Configuration option: g:fuzzy_matching_limit
+ " The maximum number of matches to return at a time. Defaults to 200, via the
+ " g:FuzzyFinderMode.TextMate.matching_limit variable, but using a global variable
+ " makes it easier to set this value.
+ruby << RUBY
+ def finder
+ @finder ||= begin
+ roots = VIM.evaluate("g:fuzzy_roots").split("\n")
+ ceiling = VIM.evaluate("g:fuzzy_ceiling").to_i
+ ignore = VIM.evaluate("g:fuzzy_ignore").split(/;/)
+, ceiling, ignore)
+ end
+ end
let g:FuzzyFinderMode.TextMate = copy(g:FuzzyFinderMode.Base)
@@ -76,8 +96,18 @@ RUBY
call s:HighlightPrompt(self.prompt, self.prompt_highlight)
let result = []
+ if exists('g:fuzzy_matching_limit')
+ let l:limit = g:fuzzy_matching_limit
+ else
+ let l:limit = self.matching_limit
+ endif
ruby << RUBY
- matches = finder.find(VIM.evaluate('self.remove_prompt(a:base)'), VIM.evaluate('self.matching_limit').to_i + 1)
+ text = VIM.evaluate('self.remove_prompt(a:base)')
+ limit = VIM.evaluate('l:limit').to_i
+ matches = finder.find(text, limit)
matches.sort_by { |a| [-a[:score], a[:path]] }.each_with_index do |match, index|
word = match[:path]
abbr = "%2d: %s" % [index+1, match[:abbr]]
@@ -85,6 +115,7 @@ RUBY
VIM.evaluate("add(result, { 'word' : #{word.inspect}, 'abbr' : #{abbr.inspect}, 'menu' : #{menu.inspect} })")
if empty(result) || len(result) >= self.matching_limit
call s:HighlightError()

5 comments on commit 5b47120


g:fuzzy_ignore is really handy, thanks!


Probably not worth a fork / pull request, but I actually changed my local fuzzy_ignore to split on “,” – that way I can do the following,

set wildignore+=.o,.obj,.bak,.exe,.pyc,.pyo,.DS_Store,.db let fuzzy_ignore=&wildignore

So I don’t have to maintain a list of globs I “don’t care about” in multiple places in my .vimrc


Meh, formatting ate my asterisks, I think you know what I meant. :)



Thank you for making this plugin even better. Have you informed the original author about your changes? I’m sure the author would like these changes.


Can I make a request that letters that match on word boundaries and capital be given a better score?

For example, if I want to find “foo_controller.rb”, I’d like to be able to type in “fc”.

Currently, the plugin gives “dispatch.fcgi” a higher ranking, because of the fcgi. This doesn’t make much sense. See this screenshot:

I wouldn’t mind forking and trying to code this on my own, so any advice is appreciated on how to improve the score when a match is on a word boundary.

Please sign in to comment.
Something went wrong with that request. Please try again.