VIM:FuzzyFinder的用法,技巧,陷阱-如何使用此插件? [英] VIM: FuzzyFinder usage, tips, gotchas - how can one make use of this plugin?

查看:314
本文介绍了VIM:FuzzyFinder的用法,技巧,陷阱-如何使用此插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

您可以通过以下方式启动FuzzyFinder 以下命令:

     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|)

所以我最近才发现有关FuzzyFinder的信息.对于已经使用了很长时间的任何人,您能否演示如何结合使用这些命令,您制作的任何映射,使用该命令时应该知道的任何陷阱?

解决方案

FuzzyFinder本身对我来说毫无用处.我将它与FuzzyFinder-TextMate和一个遍历所有文件和子目录的Ruby库结合使用,以查找文件,就像Mac上TextMate的Cmd + T选项一样.您可以在此处看到它.

不幸的是,由于原始作者停止维护该脚本,因此要花一些时间才能使它起作用.尽管如此,仍然有些人定期发布对github的更新.您将需要两个脚本, fuzzyfinder_textmate.vim 博客包含有关以下内容的更多信息如何正确使用它.另外,请查看我的 Vim设置,以了解如何使用它.该设置定义了两个键映射,s,e来模糊查找文件并分别在新窗口或当前窗口中打开文件:

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>

更新:

现在,我使用出色的 Command-T插件代替FuzzyFinder.看看我的我的超级用户答案.

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?

解决方案

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.

这篇关于VIM:FuzzyFinder的用法,技巧,陷阱-如何使用此插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆