We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
我自己也花了相当长的时间来解决这个问题。
我得到的最接近的是gccsense。不幸的是,该项目似乎已被放弃,而且由于英语不是作者的母语,因此很难建立它。
我最终从另一个角度解决了这个问题。我决定智能感知/自动完成对我的编码来说比拥有 vim 的所有可用功能更重要,所以我选择了像 Eclipse 这样的 IDE,然后找到了一个模拟 Vim 的 Eclipse 插件。到目前为止,我发现的最好的类似插件是 Viable。
以下是我尝试过但发现不满意的选项的完整列表:
如果您确实找到了满意的解决方案,请在评论中分享,因为我会对它感兴趣。
I've spent quite some time struggling with this myself.
The closest I ever got was something called gccsense. Unfortunately, the project seems abandoned and moreover it was difficult setting it up because English was not the author's first language.
I ended up approaching the problem from another angle. I made the decision that intellisense/autocomplete was more important to my coding than having all the available features of vim, so I chose an IDE like Eclipse, and then found a plugin for Eclipse that emulates Vim. So far the best kind of plugin like that that I found was Viable.
Here is the full list of options that I have tried and found unsatisfactory:
If you do find a solution you are happy with please share it in a comment, because I would be interested in it.
我自己还没有尝试过,但是
clang_indexer
似乎非常接近您正在寻找的内容(来源)。它仍然使用外部数据库(即本身不动态索引),但它似乎提供了通常只能在cscope
中找到的功能(它不太支持 C++)。对于自动完成,我使用 clang_complete。它不需要生成索引并且在大多数情况下工作得很好。它还可以在 vim 中进行自动语法检查,以便对可能出现的问题发出警告。 但它不会自动完成您提供
的
bla__x
宏示例(仅作为blah(x)
)。如果它能更容易配置就好了,但我也不认为它有问题。I haven't tried this myself yet, but
clang_indexer
seems very close to what you are looking for (sources). It still uses an external database (i.e. doesn't index on the fly per se), but it seems to offer functionality one usually only finds incscope
(which doesn't support C++ too well).For autocomplete I use clang_complete. It doesn't require generating an index and works most of the time pretty well. It also can do automatic syntax checking in vim so one is warned of possible issues. It doesn't autocomplete the macro example you gave
as
bla__x
though (only asblah(x)
). It would be nice for this to be more configurable, but I wouldn't consider this broken either.CScout 2.8 版提供了一个命令行选项 (-C),可以创建与 vim 兼容的标签文件对于它将处理的 C 源代码。 CScout 是一个用于 C 程序集合的源代码分析器和重构浏览器。它可以处理多个项目的工作空间,将 C 预处理器引入的复杂性映射回原始 C 源代码文件。因此,生成的标签文件包含通过预处理器宏创建的实体(如函数、变量和结构)的正确信息。 CScout 将使用代码的项目配置文件(相当于 Makefile)中指定的包含文件路径来处理包含文件。要尝试一下,请下载与您的设置匹配的软件包,进入包含 awk 源代码的示例目录并运行。
您可以看到 CScout 可以处理的一些类型的预处理器构造在此页面中。例如,如果您处理以下代码,
CScout 将生成一个包含以下条目的标签文件。
您可以通过在示例源代码中添加一些代码生成宏来亲自尝试一下,以查看 CScout 将创建的标签。
CScout version 2.8 offers a command-line option (-C) that will create a vim-compatible tags file for the C source code it will process. CScout is a source code analyzer and refactoring browser for collections of C programs. It can process workspaces of multiple projects mapping the complexity introduced by the C preprocessor back into the original C source code files. Consequently, the generated tags file contains correct information for entities, like functions, variables, and structures, that are created through preprocessor macros. CScout will process include files, using the include file paths specified in the code's project configuration file (the equivalent of a Makefile). To try it out, download the package matching your setup, go into the example directory containing the awk source code and run
You can see some types of preprocessor constructs that CScout can handle in this page. For example, if you process the following code
CScout will generate a tags file with the following entries.
You can try it out yourself by adding a few code-generating macros in the example source code to see the tags CScout will create.
一种可能是使用 Eclim。它是一个强大的工具,可以通过多种方式使用;在你的情况下,你必须启动一个无头 Eclipse 服务器并基本上使用 Eclipse 的索引器等。我认为你需要将你的项目注册为 Eclipse 项目。
One possibility is to use Eclim. It is a powerful tool that can be used in many ways; in your case you would have to start a headless Eclipse server and basically use Eclipse's indexer etc. I think you need to have your project registered as an Eclipse project though.
我使用“global”系统。安装后,您可以使用“global”命令来搜索代码,并使用“gtags”来建立索引。
我使用 Linux 内核,它帮了我很大的忙:它的定义更加智能(但仍然不如我想要的那么好),并且它了解函数原型、函数实现以及代码中对函数的所有引用。
还可以将“全局”与 VIM 集成,有一个插件:
祝你好运。
I use 'global' system. After you install it you have 'global' command to search your code and 'gtags' for indexing.
I work with Linux kernel and it helps a lot: it works with defines more intelligent (but still not as good as I want it) and it knows about function prototype, function implementation and all references to the function from the code.
It's also possible to integrate 'global' with VIM, there is a plugin for it:
Good luck.