问题描述
我从 vim
使用:make
,最后跳转到出现问题的文件。
最近,我注意到 gcc 4.6.1
, vim
跳转到不正确的文件/行,因为它进入了第一个报告的行,它有在ABC.h | 5 | 0包含的文件中
,并且没有调用文件在ABC.h中包含的文件中
。
有一个解决方案可以从在这种情况下, ABC.h
,但这并不能解决问题,因为有问题的文件只包含在那里。
通常,下一行代表问题出在哪里,这就是我想要跳转的地方:
MyDir / FGH。 h | 56 col 32 |错误:'坏的事情发生在这里'
在<$ c $在Vim的新版本中解决了这个问题:。
在不升级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 \ (从最新的Vim源代码中提取的设置,来自文件)
I'm using :make
from vim
and ending up jumping to the file with issues.
Recently, at least I noticed with gcc 4.6.1
, vim
jumps to incorrect file/line because it goes to the first reported line which has "In file included from ABC.h|5| 0,"
and there is no file called "In file included from ABC.h"
.
There is a solution to extract just the file name from the above line, ABC.h
in this case, but that does not solve the problem as the problematic file is only included there.
Usually the next line indicates where the issue is and that's where I would like to jump:
MyDir/FGH.h|56 col 32| error: 'bad bad thing happened here'
Is there a known fix for this in vim
?
解决方案 This a bug that is solved on new versions of Vim: Bug report logs - #62169.
You can use the following setting to solve the problem without upgrading 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
(setting extracted from latest Vim source code, from file src/option.h)
这篇关于Vim尝试在make后跳转到不存在的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!