Vim 尝试在 :make 之后跳转到不存在的文件

ste*_*anB 5 vim gcc makefile

我正在使用:makefromvim并最终跳转到有问题的文件。

最近,至少我注意到gcc 4.6.1,vim跳转到不正确的文件/行,因为它转到了第一个报告的行,"In file included from ABC.h|5| 0,"并且没有名为"In file included from ABC.h".

ABC.h在这种情况下,有一种解决方案可以仅从上述行中提取文件名,但这并不能解决问题,因为有问题的文件仅包含在那里。

通常下一行表示问题出在哪里,这就是我想跳转的地方:

MyDir/FGH.h|56 col 32| error: 'bad bad thing happened here'
Run Code Online (Sandbox Code Playgroud)

中是否有已知的修复方法vim

mMo*_*ntu 4

这个错误已在新版本的 Vim 上得到解决:错误报告日志 - #62169

您可以使用以下设置来解决问题,而无需升级Vim:

  set errorformat^=%-GIn\ file\ included\ from\ %f:%l:%c:,%-GIn\ file
           \\ included\ from\ %f:%l:%c\\,,%-GIn\ file\ included\ from\ %f
           \:%l:%c,%-GIn\ file\ included\ from\ %f:%l
Run Code Online (Sandbox Code Playgroud)

(从最新的 Vim 源代码中提取的设置,来自文件src/option.h