有没有一种使用 macvim/NERDtree 插件快速查找文件的方法?
使用 MacVim 查找和打开文件的最快方法是什么? NERDtree 是一个很棒的插件,但我仍然必须导航(有时非常深)目录树才能找到我想要的文件。是否有任何功能允许我搜索文件名的子字符串并向我显示可以从中单击的结果集?
What's the fastest way to find and open a file with MacVim? NERDtree is a great plugin, but I still have to navigate (sometimes very deep) directory trees in order to get to the file I want to get to. Is there any functionality that allows me to search a substring of a file name and show me a result set I can click on from that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您还应该查看内置命令
:find
。首先,您需要定义要搜索的目录。如果您希望将 /path/to/project 的子目录递归添加到搜索路径,请使用:
然后您可以打开例如/path/to/project/then/some/random/subdirectory/filename.ext通过发出:
要在新选项卡或分屏中打开搜索结果,请尝试使用
:tabfind
或:sfind
。编辑
我刚刚注意到您正在寻找文件的模糊匹配,在这种情况下,我不相信
:find
能够满足任务。您可能对 这个 vimtip 中定义的:Find
函数感兴趣。You should also check out the builtin command
:find
.First, you need to define what directories to search. If you wish to recursively add the subdirectories of /path/to/project to your search path, use:
You can then open e.g. /path/to/project/then/some/random/subdirectory/filename.ext by issuing:
To open your search result in a new tab or split-screen, try
:tabfind
or:sfind
instead.Edit
I just noticed that you're looking for fuzzy matching of files, in which case I don't believe
:find
is up to the task. You may be interested in the:Find
function defined in this vimtip though.由于我们都在这里列出替代方案, Command-T 是另一个试图模仿的 fuzzyfinder 式插件textmate的查找功能。
可以在此处找到文档。
Since we are all listing alternatives here, Command-T is another fuzzyfinder-esque plugin that attempts to mimic textmate's find function.
Docs can be found here.
我使用 fuzzyfinder.vim 已经快两年了,非常喜欢它。
它支持以模糊方式查找文件,例如查找foobar.rb文件,只需输入“fb”即可匹配foobar.rb,对于文件导航,可以在文件名前面添加“**/”查找任意深度的文件。它提供了更多模式来模糊地查找目录、最近打开的文件、最近的 vim 命令、标签等,您甚至可以定义自己的模式。
如果你喜欢 TextMate 的方式,可以阅读这篇文章 了解更多详情。
I use fuzzyfinder.vim for almost two years and love it a lot.
It supports to find file in fuzzy way, for example to find foobar.rb file, you can just input 'fb' to get foobar.rb matched, for file navigation, you can add "**/" in front of file's name to find a file in any levels deep. It provide more modes to find dir, recent open file, recent vim command, tags etc fuzzily, you can even define your own mode.
If you like TextMate's way, you can read this post for more details.
我使用fuzzyfinder很长时间才找到ctrp(https://github.com/kien/ctrlp.vim< /a>)
您可以创建一个适用于 Linux 和 Windows 的自定义查找命令。 ctrlp 有一些可能的设置
- 跳过文件类型或目录
- 忽略版本控制系统文件(例如:.git、hg、..)
- 使用外部命令创建文件列表(例如:linux 中的“find”命令)
- 缓存文件列表
...
它与您所说的 NERDtree 插件无关,但我认为您应该看一下...
I used fuzzyfinder for a long time before finding ctrp (https://github.com/kien/ctrlp.vim)
You could make a custom finding command that works on linux and window. There are some posible settings of ctrlp
- Skip file types or directory
- Ignore version control system files (ex: .git, hg,..)
- Use external command for making file list (ex: 'find' command in linux)
- Cache filelist
...
It is not related to NERDtree plugin that you were talking, but I think you should take a look...
与 fuzzyfinder 相同的是 PeepOpen。我已经使用它几个月了,现在比 fuzzyfinder 更喜欢它。它是严格的 Mac 系统,并且需要 Snow Leopard。
Along the same lines as fuzzyfinder is PeepOpen. I have been using it for a few months and prefer it over fuzzyfinder now. It is strictly mac, and requires Snow Leopard.
我正在使用 Vim-Plug 来管理 Vim 插件,那里是一个很棒的模糊查找器插件,名称是
fzf.vim
,它基于fzf。如果你使用 Vim-Plug,你可以像
.vimrc
文件中的以下命令一样简单地安装它:然后退出 Vim 并重新打开它并写入:
真正安装后,你可以进行任何搜索,文档是 < a href="https://github.com/junegunn/fzf.vim#commands" rel="nofollow noreferrer">此处。
I'm using Vim-Plug to manage Vim plugins, there is an awesome fuzzy finder plugin that name is
fzf.vim
which it is based on fzf. If you use Vim-Plug you can install it as easy as below commands inside.vimrc
file:Then exit Vim and re-open it and write:
After true installation you can have any search, documents are here.
我添加了以下 Nerdtree 插件,它将 grep 集成为 Nerdtree 菜单中的选项之一:
https:// gist.github.com/masaakif/414375
似乎工作得很好,它相当于“grep -r”,您甚至可以选择结果并编辑显示的文件。
I've added the following Nerdtree plugin which integrates grep as one of the options in the Nerdtree menu:
https://gist.github.com/masaakif/414375
Seems to work pretty well, it's equivalent to "grep -r" and you can even select the result and edit the file shown.