Vim 中的多文件关键字完成速度更快?
在 vim 中寻找我的 python 补全必杀技时,我开始真正喜欢
(全方位补全在工作时显然更好,但它经常报告找不到任何匹配项。好吧,Python 不是 Java,我明白了)
这种多文件补全的唯一问题是它非常慢:在我的上网本上,每次我点击
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在处理具有多个源文件的项目,此过程很可能需要一些时间(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.