如何将 cscope 输出放入 Vim QuickFix 窗口中?
我想将输出从 cscope 重定向到 Vim 快速修复窗口。粘合部分很简单,但我目前陷入了错误格式。下面是 cscope 输出的示例 (cscope -L -1 bar):
Format: "filename scope linenumber sourceline"
Example: "abc.cpp foo 25 bar()"
这意味着在 foo() 内部,abc.cpp 的第 25 行有一个对 bar() 的调用。
efm = %f\ %*[^\ ]\ %l\ %m
有效,但范围信息丢失。例如:
Input: "abc.cpp foo 25 bar()" becomes
Output: "abc.cpp |25| bar()"
我想要的是将范围包含在快速修复窗口中,如下所示:
Input: "abc.cpp foo 25 bar()" becomes
Output: "abc.cpp |25| bar() inside foo()"
是否可以仅使用错误格式来执行此操作,或者我是否需要编写一个脚本来操作输出,然后再将其提供给Vim?
I want to redirect output from cscope to Vim quickfix window. The glue part is easy enough, but I currently stuck at errorformat. Here's an example from cscope output (cscope -L -1 bar):
Format: "filename scope linenumber sourceline"
Example: "abc.cpp foo 25 bar()"
This means inside foo(), at line 25 in abc.cpp there is a call to bar().
efm = %f\ %*[^\ ]\ %l\ %m
works but the scope information is lost. For example:
Input: "abc.cpp foo 25 bar()" becomes
Output: "abc.cpp |25| bar()"
What I want is to include the scope in quickfix window, like this:
Input: "abc.cpp foo 25 bar()" becomes
Output: "abc.cpp |25| bar() inside foo()"
Is it possible to do this with errorformat only, or do I need to write a script to manipulate the output before feeding it to Vim?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需搞乱
errorformat
,只需设置cscopequickfix
并使用正常的:cscope
命令即可。例如。 (来自 vim 帮助)编辑
您还可以使用如下所示的过滤器来重新排序字段,
将其设置为过滤您的消息,然后使用
efm
Instead of messing about with
errorformat
, just setcscopequickfix
and use the normal:cscope
commands. eg. (from vim help)Edit
You could also use a filter like the following to reorder the fields
set it to filter your message, then use the
efm