Vim 中的多文件关键字完成速度更快?

发布于 2024-08-06 12:19:00 字数 348 浏览 10 评论 0原文

在 vim 中寻找我的 python 补全必杀技时,我开始真正喜欢了。:“当前文件和包含文件中的关键字”。这几乎总是让我从另一个已完成的模块中得到一个又长又难听的名字,这很棒。

(全方位补全在工作时显然更好,但它经常报告找不到任何匹配项。好吧,Python 不是 Java,我明白了)

这种多文件补全的唯一问题是它非常慢:在我的上网本上,每次我点击时,具有合理导入集的文件可能需要长达 4 或 5 秒的时间来解析。。每次我点击时,它似乎都会加载每个导入的文件。。有什么方法可以缓存文件或加快此过程吗?使用标签补全会更快吗?

While searching for my python completion nirvana in vim, I have come to really love <C-x> <C-i>: "keywords in the current and included files". This almost always gets me a long nasty name from another module completed, which is great.

(Omni-completion is obviously better when it works, but too often it reports it can't find any matches. Ok, Python isn't Java, I get it)

The only problem with this multi-file completion is it's very slow: on my netbook, a file with a reasonable set of imports can take up to 4 or 5 seconds to parse every time I hit <C-x> <C-i>. It seems to load every imported file every time I hit <C-x> <C-i>. Is there any way to cache the files or speed up this process? Would using tag completion be faster?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

故笙诉离歌 2024-08-13 12:19:00

如果您正在处理具有多个源文件的项目,此过程很可能需要一些时间(vim 需要解析所有包含的源文件以查找更多包含的源文件并构建单词列表。)您可以< /em> 使用 tag-completion,它使用 ctags 的输出来执行几乎相同的操作,但您需要运行一些测试来判断速度差异。

我个人使用完整补全(插入模式下。)默认情况下,它匹配all 所有缓冲区中的单词(甚至是已卸载的缓冲区,即已关闭的文件),但速度非常快。我发现即使您在 2-3 个字符后激活它,补全仍然非常准确。

It is quite possible that this process takes some time if you're working on projects with multiple source files (vim needs to parse all included source files to find more included source files and to build the word list.) You could use tag-completion, which uses the output of ctags to do almost the same, but you'd need to run a few tests to tell the speed difference.

I personally use complete completion (<C-P> or <C-N> in insert mode.) By default, it matches all words in all buffers (even buffers that have been unloaded, i.e. files that have been closed), but is really fast. I found that the completion works quite accurately nonetheless, even if you activate it after 2-3 characters.

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