Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: FuzzyFinder usage, tips, gotchas - how can one make use of this plugin?

Tags:

http://www.vim.org/scripts/script.php?script_id=1984

You can launch FuzzyFinder by following commands:

     Command           Mode ~     |:FufBuffer|     - Buffer mode (|fuf-buffer-mode|)     |:FufFile|       - File mode (|fuf-file-mode|)     |:FufDir|        - Directory mode (|fuf-dir-mode|)     |:FufMruFile|    - MRU-File mode (|fuf-mrufile-mode|)     |:FufMruCmd|     - MRU-Command mode (|fuf-mrucmd-mode|)     |:FufBookmark|   - Bookmark mode (|fuf-bookmark-mode|)     |:FufTag|        - Tag mode (|fuf-tag-mode|)     |:FufTaggedFile| - Tagged-File mode (|fuf-taggedfile-mode|)     |:FufJumpList|   - Jump-List mode (|fuf-jumplist-mode|)     |:FufChangeList| - Change-List mode (|fuf-changelist-mode|)     |:FufQuickfix|   - Quickfix mode (|fuf-quickfix-mode|)     |:FufLine|       - Line mode (|fuf-line-mode|)     |:FufHelp|       - Help mode (|fuf-help-mode|) 

So I just recently found out about FuzzyFinder. For anyone who's used this for quite awhile, can you demonstrate how you actually use these commands in combination, any mappings you make, any gotchas that one should know while using this?

like image 582
meder omuraliev Avatar asked Dec 12 '09 20:12

meder omuraliev


People also ask

What is fzf Vim?

If you never heard of fzf, it is a very handy general-purpose command-line fuzzy finder. Besides command-line, it is also a popular Vim plugin. If you're wondering, a fuzzy finder is a tool that helps you find what you're looking for without needing to write the full name.


2 Answers

FuzzyFinder on itself is pretty useless to me. I use it in combination with FuzzyFinder-TextMate and a Ruby library that traverses all files and subdirectories to find a file, much like the Cmd+T option for TextMate on a Mac. You can see it in action here.

Unfortunately, it takes some effort to get it to work since the original author stopped maintaining the script. There are still some people regularly posting updates to github though. You will need two scripts, fuzzyfinder_textmate.vim and fuzzy_file_finder.rb.

The latest versions work without a problem in combination with Vim FuzzyFinder 2.22.3. Your Vim has to be compiled with Ruby support otherwise it will not work. The blog of the original author contains more information on how to use it properly. Alternatively, have a look at my Vim setup to see how it can be used. The setup defines two keymappings ,s and ,e to fuzzy find a file and open it in a new window or the current window respectively:

function IdeFindTextMate()   let g:FuzzyFinderOptions.Base.key_open = '<CR>'   let g:FuzzyFinderOptions.Base.key_open_split = '<C-j>'   exe "FuzzyFinderTextMate" endfunction  function IdeSplitFindTextMate()   let g:FuzzyFinderOptions.Base.key_open = '<C-j>'   let g:FuzzyFinderOptions.Base.key_open_split = '<CR>'   exe "FuzzyFinderTextMate" endfunction  let mapleader = "," map <silent> <leader>e :call IdeFindTextMate()<CR> map <silent> <leader>s :call IdeSplitFindTextMate()<CR> 

Update:

Right now I use the excellent Command-T plugin instead of FuzzyFinder. Have a look at this superuser answer of mine for the reasons why.

like image 53
Ton van den Heuvel Avatar answered Nov 02 '22 04:11

Ton van den Heuvel


A bit late to the party, but I'd like to add that the latest version of FuzzyFinder has a new command: :FufCoverageFile, which does exactly what you'd want, i.e.:

>CoverageFile>appcontr   20: app/controllers/application_controller.rb   22: app/views/layouts/application.html.erb 
like image 32
Felix Avatar answered Nov 02 '22 04:11

Felix