有没有一种使用 macvim/NERDtree 插件快速查找文件的方法?

发布于 2024-09-09 17:17:36 字数 117 浏览 2 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

野侃 2024-09-16 17:17:36

您还应该查看内置命令 :find

首先,您需要定义要搜索的目录。如果您希望将 /path/to/project 的子目录递归添加到搜索路径,请使用:

:set path=/path/to/project/**

然后您可以打开例如/path/to/project/then/some/random/subdirectory/filename.ext通过发出:

:查找文件名.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:

:set path=/path/to/project/**

You can then open e.g. /path/to/project/then/some/random/subdirectory/filename.ext by issuing:

:find filename.ext

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.

无人接听 2024-09-16 17:17:36

由于我们都在这里列出替代方案, 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.

梦亿 2024-09-16 17:17:36

我使用 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.

余厌 2024-09-16 17:17:36

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

你是年少的欢喜 2024-09-16 17:17:36

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

荒路情人 2024-09-16 17:17:36

我正在使用 Vim-Plug 来管理 Vim 插件,那里是一个很棒的模糊查找器插件,名称是fzf.vim,它基于fzf。如果你使用 Vim-Plug,你可以像 .vimrc 文件中的以下命令一样简单地安装它:

Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'junegunn/fzf.vim'

然后退出 Vim 并重新打开它并写入:

:PlugInstall

真正安装后,你可以进行任何搜索,文档是 < 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:

Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'junegunn/fzf.vim'

Then exit Vim and re-open it and write:

:PlugInstall

After true installation you can have any search, documents are here.

泪痕残 2024-09-16 17:17:36

我添加了以下 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文