Search code examples
vimfuzzyfinder

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


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?


Solution

  • 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.